Dynamic Programming
Solves problems by reusing results from smaller subproblems.
DP Table (Calculating Fibonacci)
?
dp[0]?
dp[1]?
dp[2]?
dp[3]?
dp[4]?
dp[5]?
dp[6]Start by filling base cases.
Recurrence Relation
Where It's Used
- Problems with overlapping subproblems.
- Problems where the optimal solution depends on solutions to smaller parts.
- Optimization problems involving minimum or maximum values.
- Problems that require building solutions step by step from previous results.
Problems Using This Pattern
Climbing Stairs
Dynamic Programming
House Robber
Dynamic Programming
Coin Change
Dynamic Programming
Longest Increasing Subsequence
Dynamic Programming
Longest Common Subsequence
Dynamic Programming