(nums []int, target int)
| 1 | func pairSumSorted(nums []int, target int) []int { |
| 2 | left, right := 0, len(nums)-1 |
| 3 | for left < right { |
| 4 | sum := nums[left] + nums[right] |
| 5 | // If the sum is smaller, increment the left pointer, aiming |
| 6 | // to increase the sum toward the target value. |
| 7 | if sum < target { |
| 8 | left++ |
| 9 | } else if sum > target { |
| 10 | // If the sum is larger, decrement the right pointer, aiming |
| 11 | // to decrease the sum toward the target value. |
| 12 | right-- |
| 13 | } else { |
| 14 | // If the target pair is found, return its indexes. |
| 15 | return []int{left, right} |
| 16 | } |
| 17 | } |
| 18 | return nil |
| 19 | } |
nothing calls this directly
no outgoing calls
no test coverage detected