小马过_河

导航

twoSum

1 def twoSum(nums, target):
2     d = {}
3     for i, num in enumerate(nums):
4         if target - num in d:
5             return (d[target-num], i)
6         d[num] = i

 

posted on 2018-01-30 21:33  小马过_河  阅读(144)  评论(0编辑  收藏  举报