The full roadmap
Everything from bits to dynamic programming.
Follow it top to bottom, or jump to what you need. Every topic has a full story lesson with an animation, code in PHP, JavaScript, Java and Go, and a quiz.
Foundations
Learn to measure an idea before you code it, think in loops of loops, and play with the 0s and 1s underneath everything.
Time and space complexity
Recursion
Mathematical basics
Bit manipulation
Arrays
The row of lockers that every other structure is built on. Master walking along it, slicing it and squeezing answers out of it.
Core moves
Smart techniques
- Prefix sums
- Suffix sums
- Difference arrays
- Kadane's algorithm
- Subarrays
- Subsequence vs subarray
- Two pointers
- Sliding window
- Majority element
- Dutch National Flag
Matrix / 2D arrays
Strings
Words are just arrays with feelings. Find patterns, flip them, hash them and match them at lightning speed.
String basics
Pattern matching
Linked Lists
A train of coaches where every coach only knows the one ahead. Surprisingly powerful, wonderfully tricky.
Kinds of lists
Core operations
Cycles
Classic problems
Stack
Last in, first out, like plates at a wedding buffet. It quietly powers undo, brackets and the call stack itself.
Building a stack
Applications of stacks
Monotonic stack
Queue
First come, first served, just like the railway ticket line. From printers to job workers, queues keep the world fair.
Kinds of queues
Applications
Hashing
The art of jumping straight to the answer. The trick behind dictionaries, caches and "have I seen this before?".
Hash tables
Hashing in action
Searching
From digging through a pile to opening the dictionary in the middle. Learn to find anything fast, even answers that are not in the list.
Linear search
Binary search
- Basic binary search
- First/last occurrence
- Lower bound
- Upper bound
- Search in rotated sorted array
- Peak element
Binary search on answer
Sorting
Bring order to chaos: nine ways to line things up, and how to choose between them.
Simple sorts
Efficient sorts
Non-comparison sorts
Sorting properties
Trees
Family trees, folders, menus: anything that branches. Walk them, view them and search them in a flash.
Binary tree basics
- Tree terminology
- Binary tree representation
- Height/depth
- Diameter
- Balanced binary tree
- Maximum/minimum path
- Lowest common ancestor
Traversals
Tree views
Build and store
Binary Search Trees
Heaps
A mountain where the best item always sits on top. Perfect for "give me the biggest, smallest or top-K".
Heap basics
Heaps in action
Graphs
Maps, friendships, the internet. Learn to explore networks, find shortest routes and untangle dependencies.
Basics
- Vertices and edges
- Directed/undirected graphs
- Weighted/unweighted graphs
- Connected/disconnected graphs
- Degree
- Adjacency matrix
- Adjacency list
- Edge list
Traversals
Shortest paths
Minimum spanning tree
Ordering
Advanced graph topics
- Strongly Connected Components
- Kosaraju
- Tarjan
- Bridges
- Articulation points
- Euler path/circuit
- Hamiltonian path/circuit
- Graph coloring
Network flow
Greedy Algorithms
Always grab the best-looking choice right now. It works when a locally best choice can be proven to lead to the globally best answer.
Classics
Intervals and scheduling
Everyday puzzles
Recursion & Backtracking
Try a choice, go deeper, and if it goes wrong, step back and try another. How computers solve puzzles.
Generate everything
- Generate subsets
- Generate subsequences
- Generate permutations
- Combination sum
- Generate parentheses
- Letter combinations
Puzzles
Dynamic Programming
Never solve the same little problem twice. The skill that separates good from great, taught from the very first step.
DP fundamentals
1D DP
2D DP
Knapsack
String DP
- Longest Common Subsequence
- Longest Common Substring
- Edit distance
- Shortest common supersequence
- Distinct subsequences
- Palindromic subsequence
Advanced DP
Tries
The prefix tree behind autocomplete. Every letter is a step down a path.
Trie basics
Trie applications
Disjoint Set Union
Who is in whose gang? Merge groups and ask "are we connected?" in nearly constant time.
Core operations
Applications
Range Query Structures
Answer "what is the sum / min / max between here and there?" thousands of times, without breaking a sweat.
Prefix sum
Fenwick Tree / BIT
Segment Tree
Sparse Table
Advanced String Algorithms
Industrial-strength text tools: the engines inside search boxes, DNA analysis and plagiarism checkers.
Pattern matching
Suffix structures
Advanced Algorithms
Competitive-programming power tools for when ordinary solutions are too slow.
Big ideas
Sampling and blocks
Heavy machinery
Geometry
Problem-Solving Patterns
The 22 patterns that crack most coding interviews. Learn to recognise the pattern, then the solution writes itself.