Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

For the wonderfully curious.

See the algorithm.
Build the instinct.

Learn DSA by playing through the logic, then writing the code.

Explore a puzzle. Find the pattern. Turn your discovery into real code. This is interview prep you can get lost in.

Play your first puzzle

Try the first puzzle without signing up. Learn at your pace.

Learn by doing.
Remember by discovering.

Dune Sea/ Two Pointers
Assembling your world…
Your missionFind a pair that makes 10.
L2
3
5
8
R12
Current energy2 + 12 = 144 above target

Two beacons power the gate. Bring their combined energy to the target.

Solid connection: current pair. Gold dashed connections: pairs ruled out by the last move.

Search interval: indices 0 through 4. 5 candidates remain.

  1. sum = values[L] + values[R]
  2. if sum == target: return [L + 1, R + 1]
  3. if sum < target: L = L + 1
  4. if sum > target: R = R - 1
0 moves
Why does this work?

The stones are sorted. If the sum is too large, even the smallest remaining left stone cannot work with R. Discard R. If too small, even the largest right stone cannot work with L. Discard L. Each safe move preserves all possible answers.

See it. Reason it out. Code it.
One idea, three ways to learn.

01 · Explore

Make a move. See what changes.

02 · Discover

Understand why the pattern works.

03 · Build

Write code. Prove it with real tests.

Choose where to begin

A clear path from first principles to interview patterns.

Explore the full learning path

Start free. Your first quests let you try the method before choosing lifetime access.

Price ₹4,999lifetime access

Lifetime access is ₹4,999, paid once. No subscription or renewal fee.

See lifetime access

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead