(self, nums, target)
| 8 | |
| 9 | class Solution(): |
| 10 | def twoSum(self, nums, target): |
| 11 | hashdict = {} |
| 12 | for i, item in enumerate(nums): |
| 13 | if (target - item) in hashdict: |
| 14 | return (hashdict[target - item], i) |
| 15 | hashdict[item] = i |
| 16 | return (-1, -1) |
| 17 | s = Solution() |
| 18 | print(s.twoSum([2, 7, 11, 15], 9)) |