All questions
Intermediate · JavaScript · Maps
Two sum
Commonly asked: The most-asked coding question overall · ~10 min
Write twoSum(nums, target) returning the indices [i, j] (i < j) of two numbers that add up to target, or [] if none.
Checking your membership…