Two sum · sorted
Find two values in ascending data whose sum equals a target by moving pointers inward.
Remember: Too small: move left. Too large: move right.
Example: [2,7,11,15], target 9 → indices [0,1].
Time: O(n). Auxiliary space: O(1).
Formula: sum = a[left] + a[right]
Ascending input is required. Return zero-based indices of one pair.
Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.
The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.