Back to Patterns
2
Two Pointers
The Two Pointers pattern involves using two indices to traverse an array or string, often from opposite ends or moving at different speeds. It's highly effective for finding pairs or subarrays, especially in sorted data.