Recursion, Backtracking & DP
The hardest patterns, demystified.
Recursion, backtracking, and dynamic programming scare people - but they're one idea at three scales. Learn to generate all possibilities with backtracking, then to make overlapping recursion efficient with memoization and tabulation.
Lessons in this stage
- 01
Recursion, Deep
IntermediateBase case and recursive case, the call stack, and how to trust and design a recursive solution instead of tracing it in your head.
14 min - 02
Backtracking
AdvancedSystematically build and abandon partial solutions to generate subsets, permutations, and combinations - and to solve constraint puzzles like N-queens.
17 min - 03
Introduction to Dynamic Programming
AdvancedOverlapping subproblems and optimal substructure: turn exponential recursion into polynomial time by remembering answers (memoization).
16 min - 04
1D Dynamic Programming
AdvancedThe classic starter DPs - climbing stairs, house robber, coin change - and how to define a state and a transition.
16 min - 05
2D Dynamic Programming
AdvancedGrid paths, longest common subsequence, and the knapsack - building a table where each cell depends on earlier ones.
16 min