Step 2 of 2 · your path
DSA, Advanced
Advanced DP, union-find, shortest paths, spanning trees, SCC and bridges, segment trees and sparse tables — plus the interview strategy that turns pattern knowledge into offers.
Your progress
0 / 14 done
Up next
Advanced DP
42 min read · 15 exercises
The order I'd read them in
About 9 h 55 min of reading. Tick off what you've read, it is remembered on this device.
- Advanced DPOnce you can design the state, every "impossible" DP is just a normal DP over a stranger index.
15 exercises
- Union-Find (Disjoint Set)Twenty lines that answer "are these two connected?" in effectively constant time — forever.
14 exercises
- Advanced graph algorithmsBFS is shortest path when every edge costs 1 — here is what to do when they don't.
- Minimum Spanning TreeThe cheapest wiring that reaches every node — greedy is provably optimal here, and there are exactly two ways to be greedy.
- Advanced graphs: SCC, bridges, Euler paths, LCAOne DFS that stamps each vertex with the time it was reached answers questions that look like they need a search per vertex.
- Segment trees & Fenwick treesPrefix sums die the moment the array can change — these two structures buy back updates for a log factor.
- Sparse tables and range tricksPay O(n log n) once on an array that never changes and a range minimum costs one comparison. Doubling, blocks and reordered queries cover what a table cannot.
- String algorithmsPreprocess the pattern once, and you never have to look backward in the text again.
- Design problemsThe interface is the spec — pick the data structure combo that meets the complexity contract before you write a line of code.
- Advanced backtrackingSame three lines as before — the advanced part is saying "no" earlier and storing state in bits.
- Game theory and probability DPWhen the other side is an opponent, take the worst case; when it is chance, take the average. Either way the answer is a table over positions.
- Ordered sets without a TreeMapFloor, ceiling, rank and range counts over a set that keeps changing, built from a treap, buckets or a Fenwick tree, and the problems that need them.
17 exercises
- 8 tests · intermediate
- 9 tests · intermediate
- 8 tests · advanced
- 8 tests · advanced
- 8 tests · intermediate
- 7 tests · intermediate
- 8 tests · advanced
- 8 tests · advanced
- 9 tests · advanced
- 8 tests · advanced
- 9 tests · advanced
- 10 tests · intermediate
- 8 tests · advanced
- 8 tests · advanced
- 8 tests · advanced
- 7 tests · intermediate
- 8 tests · intermediate
- Sweep line, offline queries and geometrySort the moments when something changes, keep a summary of what is active, and skylines, offline queries and most geometry questions become one pass.
17 exercises
- 8 tests · intermediate
- 8 tests · intermediate
- 10 tests · advanced
- 9 tests · intermediate
- 9 tests · advanced
- 8 tests · intermediate
- 10 tests · advanced
- 10 tests · intermediate
- 9 tests · intermediate
- 9 tests · advanced
- 8 tests · intermediate
- 9 tests · advanced
- 10 tests · advanced
- 8 tests · intermediate
- 9 tests · advanced
- 10 tests · advanced
- 8 tests · intermediate
- Interview strategyThe algorithm is half the score — the other half is everything you say before, during and after writing it.
Practice at this level
Every exercise opens in the editor with tests you can run.
- Advanced DP · 8 tests
- Advanced DP · 8 tests
- Advanced DP · 9 tests
- Advanced DP · 8 tests
- Advanced DP · 9 tests
- Advanced DP · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Interview strategy · 8 tests
- Interview strategy · 8 tests
- Advanced graph algorithms · 8 tests
- Advanced graph algorithms · 8 tests
- Advanced graph algorithms · 9 tests
- Advanced graph algorithms · 9 tests
- Advanced graph algorithms · 8 tests
- Union-Find · 8 tests
- Union-Find · 8 tests
- Union-Find · 8 tests
- Union-Find · 10 tests
- Union-Find · 9 tests
- Minimum Spanning Tree · 8 tests
- Minimum Spanning Tree · 9 tests
- Advanced backtracking · 8 tests
- Advanced backtracking · 9 tests
- Advanced backtracking · 9 tests
- Advanced backtracking · 8 tests
- Design problems · 8 tests
- Design problems · 8 tests
- Design problems · 8 tests
- Design problems · 8 tests
- String algorithms · 8 tests
- String algorithms · 9 tests
- String algorithms · 9 tests
- String algorithms · 9 tests
- String algorithms · 9 tests
- Design problems · 8 tests
- Advanced DP · 11 tests
- Advanced DP · 10 tests
- Advanced DP · 11 tests
- Advanced DP · 10 tests
- Advanced DP · 10 tests
- Advanced DP · 10 tests
- Advanced DP · 11 tests
- Advanced DP · 11 tests
- Advanced DP · 10 tests
- Advanced DP · 10 tests
- Advanced graph algorithms · 10 tests
- Advanced graph algorithms · 11 tests
- Advanced graph algorithms · 11 tests
- Advanced graph algorithms · 10 tests
- Advanced graph algorithms · 11 tests
- Advanced graph algorithms · 10 tests
- Advanced graph algorithms · 12 tests
- Advanced graphs · 9 tests
- Advanced graphs · 8 tests
- Advanced graphs · 8 tests
- Advanced graphs · 9 tests
- Advanced graphs · 9 tests
- Advanced graphs · 9 tests
- Advanced graphs · 8 tests
- Advanced graphs · 8 tests
- Advanced graphs · 8 tests
- Advanced graphs · 8 tests
- Advanced graphs · 9 tests
- Minimum Spanning Tree · 8 tests
- Minimum Spanning Tree · 8 tests
- Minimum Spanning Tree · 8 tests
- Minimum Spanning Tree · 8 tests
- Minimum Spanning Tree · 7 tests
- Minimum Spanning Tree · 8 tests
- Minimum Spanning Tree · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Segment & Fenwick trees · 8 tests
- Sparse tables · 8 tests
- Sparse tables · 8 tests
- Sparse tables · 7 tests
- Sparse tables · 7 tests
- Sparse tables · 8 tests
- Sparse tables · 8 tests
- Sparse tables · 7 tests
- Sparse tables · 8 tests
- Sparse tables · 8 tests
- Sparse tables · 9 tests
- String algorithms · 8 tests
- String algorithms · 8 tests
- String algorithms · 8 tests
- String algorithms · 8 tests
- String algorithms · 8 tests
- String algorithms · 8 tests
- String algorithms · 8 tests
- Union-Find · 11 tests
- Union-Find · 11 tests
- Union-Find · 11 tests
- Union-Find · 12 tests
- Union-Find · 10 tests
- Union-Find · 11 tests
- Union-Find · 12 tests
- Interview strategy · 8 tests
- Interview strategy · 8 tests
- Interview strategy · 8 tests
- Interview strategy · 9 tests
- Design problems · 9 tests
- Design problems · 8 tests
- Design problems · 8 tests
- Design problems · 8 tests
- Design problems · 8 tests
- Design problems · 8 tests
- Advanced backtracking · 9 tests
- Advanced backtracking · 8 tests
- Advanced backtracking · 9 tests
- Advanced backtracking · 9 tests
- Advanced backtracking · 8 tests
- Advanced backtracking · 8 tests
- Games & probability DP · 6 tests
- Games & probability DP · 6 tests
- Games & probability DP · 6 tests
- Games & probability DP · 8 tests
- Games & probability DP · 8 tests
- Games & probability DP · 7 tests
- Games & probability DP · 6 tests
- Games & probability DP · 7 tests
- Games & probability DP · 7 tests
- Games & probability DP · 8 tests
- Games & probability DP · 7 tests
- Games & probability DP · 8 tests
- Games & probability DP · 8 tests
- Games & probability DP · 8 tests
- Ordered structures · 8 tests
- Ordered structures · 8 tests
- Ordered structures · 7 tests
- Ordered structures · 8 tests
- Ordered structures · 9 tests
- Ordered structures · 8 tests
- Ordered structures · 10 tests
- Ordered structures · 8 tests
- Ordered structures · 7 tests
- Sweep line & geometry · 8 tests
- Sweep line & geometry · 9 tests
- Sweep line & geometry · 10 tests
- Sweep line & geometry · 9 tests
- Sweep line & geometry · 10 tests
- Sweep line & geometry · 10 tests
- Sweep line & geometry · 9 tests
- Sweep line & geometry · 9 tests
- Sweep line & geometry · 8 tests
- Sweep line & geometry · 9 tests
- Sweep line & geometry · 10 tests
- Sweep line & geometry · 8 tests
- Sweep line & geometry · 9 tests
- Sweep line & geometry · 10 tests
- Advanced backtracking · 10 tests