Two that add up to the target

A code exercise of about 15 minutes: read the statement, solve «Two that add up to the target» in the browser and get a review like in a real interview.

Code · 15 min
Loading…

Statement

Write twoSum(nums, target): return the indices [i, j] (with i < j) of the two numbers that add up to target. If there are several pairs, the one with the smallest j; if there are none, [].