Home / DSA / Lesson 9

Dynamic programming — start here

Advanced 10 min read Lesson 9 of 9

DP is recursion with memory (memoization) or filling a table bottom-up. Use it when the same subproblem is solved many times and the best answer is built from best answers of smaller sizes.

Climbing stairs: ways(n) = ways(n-1) + ways(n-2), same as Fibonacci. Coin change: dp[x] = fewest coins to make amount x; try each coin.

Service-company easy rounds often skip hard DP. TCS Digital / product companies do not.

Judge: Climbing stairs, Fibonacci, Coin change. Pattern: 1D DP.