Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def twoSum(self, nums, target):
- dict = {}
- for i in range(len(nums)):
- dict[nums[i]] = i
- for j in range(len(nums)):
- other = target - nums[j]
- if other in dict.keys() and dict[other] != j:
- return [j, dict[other]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement