Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
11 lines (9 sloc) 349 Bytes
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
hashmap = {}
for i, vi in enumerate(nums):
if (target - vi) in hashmap.keys():
if hashmap[target - vi] != i:
return [hashmap[target - vi],i]
else:
hashmap[vi] = i
You can’t perform that action at this time.