Two Integer Sum II, four ways

Try:
CALL
1 / 1

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

numbers

Indices under the cells are 0-based; the answer adds 1

Keyboard: ← → step, Space play or pause. 2 to 10 sorted numbers (−99 to 99) with exactly one pair adding up to target. Answers are 1-based. In the Python hash-map version, mp[tmp] on a defaultdict also inserts tmp with 0; the map panel shows only real entries.