two sum
hash map / dictionaryeasyfunction
Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target.
examples
input
[[2,7,11,15], 9]expected
[0,1]input
[[3,2,4], 6]expected
[1,2]Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target.
input
[[2,7,11,15], 9]expected
[0,1]input
[[3,2,4], 6]expected
[1,2]