题目描述见2-1
代码:
1 class Solution(object): 2 def twoSum(self, nums, target): 3 if len(nums) <= 1: 4 return False 5 buff_dict = {} 6 for i in range(len(nums)): 7 if nums[i] in buff_dict: 8 return [buff_dict[nums[i]], i] 9 else: 10 buff_dict[target - nums[i]] = i