Two Pointers1 article
Two Pointers
Two pointers shrink the search space from both ends. Once you see sorted input or a pair-sum constraint, reach for this pattern.
Related:Sliding Window
Two pointers shrink the search space from both ends. Once you see sorted input or a pair-sum constraint, reach for this pattern.