🚀 Phases 1–5 are live — Days 1–17 cover the foundations and the algorithmic patterns. See the roadmap →
Day 25 - Two PointersPractice QuestionsOverview

Two Pointers Practice Questions

Ten interview classics, every flavor represented. Each problem is a direct instance of one of the opposite-ends, same-direction, or fast-and-slow templates — once you spot which flavor it is, the code writes itself.

Before reading any solution, force yourself through the four-question checklist:

  1. Which flavor? (Opposite-ends / same-direction / fast-and-slow)
  2. What does each pointer represent?
  3. What’s the movement rule?
  4. When do I stop?

The code is six to ten lines. The whole chapter.

Easy

ProblemPatternStatus
Two Sum II — Input Array Is SortedOpposite-ends, classic convergenceAvailable
Valid PalindromeOpposite-ends with skip-junk inner loopAvailable
Remove Duplicates from Sorted ArraySame-direction read/writeAvailable
Squares of a Sorted ArrayOpposite-ends, fill from the backAvailable

Medium

ProblemPatternStatus
3SumSort + fix one + two-pointer + dedupAvailable
Container With Most WaterOpposite-ends, move the shorter sideAvailable
Sort ColorsThree-pointer Dutch national flagAvailable
Linked List Cycle IIFloyd’s + reset + same-speed passAvailable
Find the Duplicate NumberArray as linked list + Floyd’sAvailable

Hard

ProblemPatternStatus
Trapping Rain WaterOpposite-ends with running max on each sideAvailable

More Practice (Coming Soon)

ProblemPatternStatus
4SumK-Sum reductionComing Soon
3Sum Closest3Sum with min-distance trackingComing Soon
Remove Duplicates from Sorted Array IISame-direction with “allow 2 of each”Coming Soon
Boats to Save PeopleOpposite-ends greedy pairingComing Soon
Merge Sorted Array (in place)Right-to-left two-pointerComing Soon
Backspace String CompareTwo-pointer from the rightComing Soon
Longest Word in DictionaryTwo-pointer subsequence matchingComing Soon
Palindrome Linked ListFind middle + reverse + compareComing Soon
Happy NumberFloyd’s cycle on digit-square-sumComing Soon
Move ZeroesSame-direction read/writeComing Soon