Target-sum pair in a sorted list
nums is sorted in non-decreasing order and may repeat values. Return the positions [i, j], with i < j, of the two numbers that add up to target. At most one pair of positions works; if none does, return []. Positions start at 0.
Aim for O(n) time and O(1) extra space: the sorted order replaces a hash map.
Besides the tests, one large input (6,000 sorted numbers) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
pair_in_sorted([1,4,6,9,13], 15)→[2,3]pair_in_sorted([-5,-1,0,3,8], 7)→[1,4]pair_in_sorted([1,2,4], 4)→[]