Given a sorted array of integers and a target, return the indices of two distinct elements whose sum equals the target. The sorted order allows a classic two-pointer scan from both ends.
nums = sorted array of integers, target = required sum
0-based indices of the pair
Example 1:
Input:
nums = [2,7,11,15] target = 9
Output:
[1,2]
Explanation:
2 + 7 = 9.
Example 2:
Input:
nums = [2,3,4] target = 6
Output:
[1,3]
Explanation:
2 + 4 = 6.