2
This commit is contained in:
9
solutions/lc1.py
Normal file
9
solutions/lc1.py
Normal file
@@ -0,0 +1,9 @@
|
||||
class Solution:
|
||||
def twoSum(self, nums: List[int], target: int) -> List[int]:
|
||||
seen = {}
|
||||
for i, x in enumerate(nums):
|
||||
need = target - x
|
||||
|
||||
if need in seen:
|
||||
return [seen[need], i]
|
||||
seen[x] = i
|
||||
Reference in New Issue
Block a user