Dynamic Programming21 sections · 916 units
Open in Course

Section Recap

What we learned

Look at what you can do now:

1.1. Resource tracking DP (Red Green Towers): dp[i][j]dp[i][j] = answer after ii steps using jj of some resource.

2.2. Grid DP (Grid 1): dp[i][j]dp[i][j] = answer for cell at row ii, column jj.

3.3. String DP (Edit Distance): dp[i][j]dp[i][j] = answer comparing first ii characters of one string to first jj of another. The same 2D table structure, but the indices mean completely different things. Recognizing which pattern fits your problem is the key skill. In the next section, you'll work through Knapsack problems, a special case of resource tracking DP.