Pattern Recognition Drill
Easy Two Pointers
The Problem
Given a sorted array, remove duplicates in-place and return the new length.
What approach would you use?
Think about it before scrolling down.
Slow pointer writes unique values. Fast pointer scans. When different, advance slow and copy. O(n).
Same idea with a write index. Every unique element gets written to the next position.
Common Trap
Don't shift the entire array when removing — just overwrite with the slow pointer.