GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — leetcode/python/167_Two_Sum_II_Input_array_is_sorted.py at master · qiyuangong/leetcode Expand file tree/ Copy path167_Two_Sum_II_Input_array_is_sorted.pyMore file actions 18 lines (17 loc) · 488 Bytes / Copy path167_Two_Sum_II_Input_array_is_sorted.pyFile metadata and controls18 lines (17 loc) · 488 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class Solution(object): def twoSum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ # Two Points begin, end = 0, len(numbers) - 1 while begin < end: curr = numbers[begin] + numbers[end] if curr == target: return [begin + 1, end + 1] elif curr < target: begin += 1 else: end -= 1 |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |