AlgoViz
← All drills
🧠 Drill · Think it through

Closing in from both shores

The problem

You're handed an array of weights that is already sorted in increasing order, plus a target. Return whether any two of them add up to exactly the target, using no extra storage. Because it's sorted, a smaller weight sits to the left and a larger one to the right.

Don't jump to code. Walk the four questions an expert asks first — you'll build the habit, not just the answer.

1

Restate it

Before anything else — did you read what's actually being asked? Strip the story to the bare goal.

Strip away the story. What are we actually asked to find?