class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
>>> Solution().twoSum([2, 7, 11, 15], 9)
[0, 1]
"""
complement_map = {}
for index, x in enumerate(nums):
if complement_map.get(x, None) is None:
complement_map[target - x] = index
else:
return [complement_map.get(x), index]