Pair Sum in a Sorted Array
Given an array of integers sorted in ascending order and a target value, return the indices of two distinct elements that sum to the target, or [-1, -1] if no such pair exists. Solve it in O(n) time and O(1) extra space.
Hints
Hint 1
Start one pointer at each end. What does the current sum tell you about which pointer can safely move?
Hint 2
If the sum is too small, moving the right pointer left only makes it smaller — so only one move can ever help.