Build the PrimitiveMedium
Two Sum II — Sorted Input
Write `two_sum_sorted(nums, target)` where `nums` is sorted ascending. Return the 0-based indices `(i, j)` with `i < j` of the two values summing to `target`. Exactly one answer exists. Use O(1) extra space.
two_sum_sorted([2, 7, 11, 15], 9) -> (0, 1)
A hash map solves it but spends O(n) memory the sortedness makes unnecessary. Start a pointer at each end: if the sum is too small only the left pointer can help, if too large only the right can. The interview is whether you can justify that discarding step, not whether you can code it.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.