š¹ 1. Recursion Problems (Foundation)
Use recursion when a problem can be defined in terms of smaller self-similar subproblems with a clear base case.
A. Mathematical Recurrence
- Factorial of
n
- Fibonacci numbers (naĆÆve recursion)
- Power of
n
(x^n
) using recursion - Greatest Common Divisor (Euclidean algorithm)
B. Divide & Conquer
- Binary Search
- Merge Sort
- Quick Sort
- Maximum/Minimum in an array
- Count inversions in an array
C. Recursion with Strings/Arrays
- Reverse a string recursively
- Palindrome check recursively
- Print all subsequences of a string
- Print all permutations of a string
D. Tree/Graph Recursion
- Tree traversals (inorder, preorder, postorder)
- Height/Depth of a binary tree
- Count nodes in a binary tree
- Lowest Common Ancestor (LCA) using recursion
- DFS on a graph
š¹ 2. Backtracking Problems (Branching + Choices + Undo)
Backtracking = Recursion + exploring multiple choices + pruning/undo when a choice doesnāt work.
A. Classic Backtracking
- N-Queens problem
- Rat in a Maze (all paths)
- Knightās Tour problem
- Sudoku solver
- Word Search in a grid
B. Subsets/Permutations/Combinations
- Generate all subsets of a set
- Generate all permutations of a string/array
- Combination Sum (with/without duplicates)
- Phone keypad letter combinations
- Partition to K equal sum subsets
C. Constraint-Solving
- Hamiltonian Path in a graph
- Coloring a graph
- Word break using backtracking
- Crossword fill problem
š¹ 3. Dynamic Programming Problems (Overlapping Subproblems + Optimal Substructure)
DP is recursion optimized with memoization/tabulation. Usually involves optimization: min, max, count, true/false.
A. 1D DP (Basic)
- Fibonacci with memoization
- Climbing Stairs (ways to reach top)
- Min cost climbing stairs
- House Robber problem
- Jump Game (can reach end?)
B. Subset/Knapsack Problems
- Subset Sum problem
- Partition Equal Subset Sum
- 0/1 Knapsack problem
- Unbounded Knapsack
- Coin Change (min coins / total ways)
C. String DP
- Longest Common Subsequence (LCS)
- Longest Common Substring
- Edit Distance (Levenshtein)
- Palindrome Partitioning (min cuts)
- Regular Expression Matching
D. Grid/Matrix DP
- Unique Paths in a grid
- Minimum Path Sum
- Maximal Square of 1s
- Cherry Pickup problem
- Gold Mine problem
E. Advanced DP
- Longest Increasing Subsequence (LIS)
- Longest Bitonic Subsequence
- Matrix Chain Multiplication
- Egg Dropping problem
- Rod Cutting problem
- Stage 1 ā Recursion: Solve problems until recursion feels natural (focus on base/recursive cases).
- Stage 2 ā Backtracking: Pick problems with multiple choices & constraints.
- Stage 3 ā DP: Start with recursive solutions ā then optimize with memoization ā then tabulation.
ā” By mastering these ordered problem lists, youāll instantly know:
- āThis is recursionā ā self-similar breakdown.
- āThis is backtrackingā ā choices + pruning.
- āThis is DPā ā overlapping subproblems + optimization.