Two Sum

Moyen · 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.

Tests d'exemple

solution([2, 7, 11, 15], 9) // => [0, 1]

Soumettre

Classement