Two Sum
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
patch_hash = {}
for ind, num in enumerate(nums):
if (target - num) in patch_hash.keys():
return [patch_hash[target - num], ind]
else:
patch_hash[num] = ind
Reference: