Two Pointers
Domain: Algorithms
🎯 Motivation
Use two indices moving through the array to solve problems like pair-finding, reversal, or partitioning in O(n) with O(1) space.
📋 Concrete Example
Find two numbers that sum to 10 in sorted [1, 3, 4, 6, 7, 9]: left=0 (1), right=5 (9). 1+9=10! Or: left=1 (3), right=4 (7). 3+7=10!
🔗 Analogy
Two people walking toward each other from opposite ends of a corridor, checking items as they meet. Much faster than one person checking every pair.