1class Solution: 2 def twoSum(self, nums: List[int], target: int) -> List[int]: 3 _dict = {} 4 for i in range(len(nums)): 5 x = target - nums[i] 6 if x not in _dict: 7 _dict[nums[i]] = i 8 else: 9 return [i, _dict[x]]