Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. python code example
Example: two sum in python with 0ms runtime
def twoSum(self, nums: List[int], target: int) -> List[int]: dictionary = {} answer = [] for i in range(len(nums)): secondNumber = target-nums[i] if(secondNumber in dictionary.keys()): secondIndex = nums.index(secondNumber) if(i != secondIndex): return sorted([i, secondIndex]) dictionary.update({nums[i]: i})