Two Sum
Medium · javascript · javascript · algorithms
Write solution(nums, target) that returns the indices [i, j] (i < j) of the two numbers in nums that add up to target. Assume exactly one solution exists.
Sample tests
solution([2, 7, 11, 15], 9) // => [0, 1]