Find two numbers in a list that add up to a target using a dictionary for O(n) speed.
Constraints
Example
>>> two_sum([2, 7, 11, 15], 9) [0, 1] >>> two_sum([3, 2, 4], 6) [1, 2] >>> two_sum([3, 3], 6) [0, 1]
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints