Given an array sorted in non-decreasing order and a target sum, return the two values that add up to the target — or an empty array if no such pair exists.
Example 1
Explanation: The two endpoints already sum to the target, so the pointers find them immediately with no movement needed.
Example 2
Explanation: No two values in the array sum to 8, so an empty array signals that no pair exists.
Example 3
Explanation: Two different indices holding the same value still count as a valid pair.
How would the two-pointer sweep need to change if you had to return every distinct pair that sums to the target, not just one?
Code execution is coming soon.