LC 0167 [E] Two Sum 2Sum II Input array is sorted - ALawliet/algorithms GitHub Wiki

class Solution:
    def twoSum(self, numbers: List[int], target: int) -> List[int]:
        l = 0
        r = len(numbers) - 1
        while l < r:
            s = numbers[l] + numbers[r]
            if s == target:
                return [l+1, r+1]
            elif s < target:
                l += 1
            elif s > target:
                r -= 1
        return [-1, -1]