Two Pointer: Pair Sum
Easy
arrays
Google
Apple
Microsoft
Given a sorted array of integers, find two numbers that add up to a target. Return their indices as a tuple. Assume exactly one solution exists.
Example
pair_sum([1, 2, 3, 4, 6], 6)
# => (1, 3) (nums[1] + nums[3] = 2 + 4 = 6)
Test Cases
Python Editor
Output
Click "Run" to see results...