Code
The highlighted line runs next. The pill shows the live values in the running call.
Cost
Work done so far, and how the four solutions compare
Array
Arrows mark the positions in play
The highlighted line runs next. The pill shows the live values in the running call.
Work done so far, and how the four solutions compare
Arrows mark the positions in play
Keyboard: ← → step, Space play or pause. Up to 10 numbers; the input must have exactly one valid pair, as the problem promises. Try "no self-pair" ([3,2,4], target 6) in the hash map modes: 3 + 3 = 6, but index 0 can't be used twice.