GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — leetcode/python/167_Two_Sum_II_Input_array_is_sorted.py at master · qiyuangong/leetcode

Expand file tree

/

167_Two_Sum_II_Input_array_is_sorted.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
18 lines (17 loc) · 488 Bytes
/

167_Two_Sum_II_Input_array_is_sorted.py

Copy path

File metadata and controls

18 lines (17 loc) · 488 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.