1 个评论

class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
dic = {}
for i,num in enumerate(nums):
if target-num in dic:
return [dic[target-num],i]
else:
dic[num] = i

要回复文章请先登录注册