Dynamic Programming21 sections · 916 units
Open in Course

Section Recap

What we learned

You learned Game Theory DP for two-player games with optimal play.

1.1. A state is winning if any move leads to a losing state for the opponent. A state is losing if all moves lead to winning states.

2.2. For score games, track the score difference. The recurrence subtracts the opponent's best result because their gain is your loss.

3.3. Interval games (pick from ends) use dp[i][j]dp[i][j]. Games with extra rules add parameters. Games with used elements use bitmasks. When a problem says "both players play optimally," think minimax. Model the game state, define what winning means, and build the DP from base cases.