visualization
Two Pointers
Each comparison kills a whole row of candidates.
nums = [1, 3, 4, 6, 8, 11, 13] · target = 10step 1/12
Sorted array. L starts at the smallest value, R at the largest. Target sum: 10.
pseudocode
L, R = 0, len(nums) - 1while L < R:if nums[L] + nums[R] == target:return (L, R)elif nums[L] + nums[R] < target:L += 1 # sum too smallelse:R -= 1 # sum too big