Two pointers interview questions
Pairs from both ends, partitioning, reversing in place, merging.
4 questions solved with this pattern, most asked first. Reported by candidates in public interview write-ups and reworded by Scrivio. How the reports are counted
Your progress: 0 of 4 done, 0 saved
Merge two sorted arrays into one sorted array.
Reported 47 times
Read the solutionArrays and stringsExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2019, geeksforgeeks.org 2017
Sort an array that holds only the values 0, 1 and 2 in a single pass.
Reported 41 times
Read the solutionArrays and stringsExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2018, geeksforgeeks.org 2024
Given an array holding only 0s and 1s, sort it in O(n) time.
Reported 27 times
Read the solutionSorting and searchingExample sources
3 of the write-ups counted: aced.io 2020, geeksforgeeks.org 2021, geeksforgeeks.org 2020
Sort an array containing only 0s, 1s and 2s in a single pass.
Reported 19 times
Read the solutionSorting and searchingExample sources
3 of the write-ups counted: geeksforgeeks.org 2017, geeksforgeeks.org 2019, geeksforgeeks.org 2016