AlgoViz
← Back to the lesson
🧩 Puzzle · Apply Two Pointers

Close the gap

Two numbers in this sorted list add up to the target. Start from both ends and squeeze inward: if the sum is too small grow it, too big shrink it. Each move rules out a whole row of pairs.

Target sum13
Current sum1 + 15 = 16
L
1
2
4
7
11
R
15
Pick a move to start closing in on the target.
moves: 0