Skip to content

11. Dynamic Programming

🧠 DP Strategy

  1. Define State: dp[i] or dp[i][j]? What does it represent?
  2. Transition: How do I get to dp[i] from dp[i-1]?
  3. Base Case: What is the answer for 0 items?

🟢 1D DP: Basics & Linear

🟡 2D DP: Grids & Paths

🟠 Knapsack Pattern

🔴 Strings (LCS & Editing)

🟣 MCM & Intervals