5 two pointer patterns
Tap to start →
One pointer at each end, moving inwards. Palindromes, reversing.
Sum too small? Move left up. Too big? Move right down.
Fast reads, slow writes. Removes duplicates in place.
Each pointer moves at most n times. No extra array.
Using pair-sum pointers on an unsorted array. It only works when it's sorted.
Tap an answer. The full video explains why.
Free DSA in Java course. Subscribe to Compiled Canvas on YouTube.