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