Two Pointer Technique: Solving Pair and Partition Problems in O(n)
Mar 29 · 16 min read · TLDR: Place one pointer at the start and one at the end of a sorted array. Move them toward each other based on a comparison condition. Every classic pair/partition problem that naively runs in O(n²) collapses to O(n) with this one idea — and masteri...
Join discussion
























