# 前后两个指针往中间靠 class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: i = 0 j = len(numbers) - 1 result = [] while i < j: if numbers[i] + numbers[j] > target: j -= 1 elif numbers[i] + numbers[j] < target: i += 1 else: result.append(i+1) result.append(j+1) break return result