A structured learning path

Learn DSA the way
it should be taught.

Most DSA study is backwards — grinding problems until solutions stick by accident. This path builds mental models first. Understand the why before writing a line of code.

The result: you recognize what kind of problem you're looking at — not because you memorized the solution, but because the intuition is actually yours.

3phases
22mental models
58problems
The usual approach

Grinding leaves too much to chance.

Solving 200 random problems teaches you 200 solutions. Ask yourself which ones you could reproduce cold — without the label, without having seen it recently. Pattern matching by accident doesn't transfer to problems you haven't seen before.

This path

Real pattern recognition is built deliberately.

This path teaches you to see the structure of a problem — not because you've seen it before, but because you understand the underlying pattern. That understanding transfers to problems you've never encountered.

Step 1Build the foundation

Every data structure gets its own mental model.

Before you encounter a single problem, you understand the tools you'll use to solve them — each one through a single real-world analogy that makes the structure obvious.

Explore fundamentals →
conveyor belt
3
0
1
0
2
.
.
W
R
.
W places keepers
R inspects everything
Fundamentals
Arrays & Strings
The Assembly Line

A conveyor belt with a reader and writer. The reader inspects everything; the writer only places keepers. One pass, no extra space.

Two PointersWrite CursorPrefix Pass
card catalog
"name"
slot 3
"Alice"
"age"
slot 7
30
"city"
slot 1
"NYC"
any key → O(1) lookup
Fundamentals
Hash Maps & Sets
The Library Card Catalog

Any book found in one step, no matter how large the library. Membership, lookup, counting — all O(1).

HashMapHashSetO(1) lookup
binary tree
15
10
20
8
12
17
25
left < parent < right
Fundamentals
Binary Trees
File System Navigation

Folders nested inside folders. DFS follows one path to its end; BFS visits every folder at each depth before going deeper.

DFSBFSRecursion
city road map
ABCDE
nodes + edges · visited set
Fundamentals
Graphs
The City Road Map

Cities connected by roads. Unlike trees, graphs can cycle — so you mark every city you visit to avoid looping forever.

Adjacency ListVisited SetBFS / DFS
ER triage
most critical always at top
1
3
2
8
7
4
5
parent ≤ children
min always at root · O(log n)
Fundamentals
Heaps
ER Triage

The most critical patient is always seen first — not by arrival order, but by severity. The heap always surfaces the min (or max) in O(1).

Priority QueueO(log n)Min / Max
Step 2Apply the foundation

Then tackle real algorithms — with a story for each.

Each problem gets its own analogy. You already know the tools — now you learn exactly which one applies, and why, before writing a line of code.

Browse all problems →
1
2
3
1dup!
already
in album!
album = {1, 2, 3}
217Contains DuplicateEasy
The Stamp Collector's Album

A collector checks their album before mounting each stamp. The instant a design appears twice — stop. No need to finish the pile.

Hash SetO(n) time
r
a
c
e
c
a
r
L
R
c == c ✓ — inspectors agree
125Valid PalindromeEasy
The Two Museum Inspectors

Two inspectors walk from opposite ends, skipping empty pedestals, comparing exhibits. Always agree — mirror layout confirmed.

Two PointersO(1) space
nums
1
2
3
4
L →
1
1
2
6
← R
24
12
4
1
out
24
12
8
6
238Product Except SelfMedium
The Two Messengers

Two messengers walk opposite directions through a row of villages, writing their tally before absorbing each harvest. No village sees its own.

Prefix / SuffixO(n) time
Start0
A10
B15
C30
C − A = 30 − 10 = 20 miles
560Subarray Sum = KMedium
The Checkpoint Journey

Record your odometer at every city. The distance between two checkpoints is just subtraction. A logbook of past readings makes any target instant to find.

Prefix SumsHashMap
start""open=2, close=2
╰─"("open=1
├─"(("→ "(())"
╰─"()"→ "()()"
( = climb  ) = descend  can't go below ground
022Generate ParenthesesMedium
The Mountain Climber

Every ( is a step up, every ) a step down. You can only descend if you've climbed. Every valid route ends back at ground level.

BacktrackingRecursion
~
~
~
~
~
~
~
~
~
~
~
surveyed   land  ~ ocean
200Number of IslandsMedium
The Park Ranger Survey

Spot uncharted land, radio a survey team. They fan out and plant flags on every connected tile. One call claims the whole island.

DFS / BFSGraph
Inside a lesson

Every step of learning is intentional.

FORWARD PASSalbum = 3
numsresult
1
1
0
2
1
1
3
1
2
1
0
3

Stamp 1: already in album! → return true ✓

■ prefix stored■ final value
5 / 6
Visual Tracers

See the algorithm run before you write a line.

Interactive step-through tracers let you advance frame by frame — watching each variable change, each array cell light up, the state evolving visually before you ever touch the keyboard.

The algorithm stops being abstract. You can see exactly what it's doing at every step.

1
2
3
4
5
6
7
8
9
10
function containsDuplicate(nums: number[]): boolean {
const stampAlbum = new Set<number>();
 
for (const stamp of nums) {
if (stampAlbum.has(stamp)) return true;
stampAlbum.add(stamp);
}
 
return false;
}
PASS has duplicate at endPASS no duplicatesPASS all same value
Step-by-Step Building

Build the algorithm yourself.

Each concept unlocks incrementally inside a real in-browser editor. You write the solution — guided, but never handed the answer.

217Contains DuplicateEasy
📖 The Stamp Collector's Album

A collector scans a pile of stamps, checking their album before mounting each one. If the design is already mounted — a duplicate is found. Stop immediately.

Hash SetO(n) time
1
2
3
1
← duplicate detected
Mental Models

Every pattern has an unforgettable analogy.

Before any code appears, the pattern is explained through a single real-world metaphor you won't forget. The algorithm becomes obvious once the intuition is there.

The loop

Three steps. Repeated across every section.

01
Read the mental model

Each section opens with a guide built around a real-world analogy — the why, not just the how.

02
Apply it immediately

A focused set of problems locks in what you just read while it's still fresh. Doing before forgetting.

03
Revisit as you advance

Harder problems from previous models resurface in later steps — exactly when you're ready for them.

Ready to build real intuition?

The path starts with the fundamentals and scales to expert-level techniques — one mental model at a time.

View the path →