Searching easy time O(n) space O(1)
Two Sum (Sorted)
On a sorted array, start a pointer at each end. If the pair sums too high, move the right pointer in; too low, move the left pointer in. They converge on the answer, or cross with no pair.
Find two values that add up to 14.
1 / 4
Practice
Machine twin: /dsa-viz-v2/two-sum-sorted.json — the full deterministic run as structured data.