Patterns

GT · Pattern 21

Game Theory & Minimax

Solve two-player zero-sum games where both players play optimally. Generally solved by exploring all future game states using DP or recognizing a mathematical pattern.

1111123413610141020i=0i=1i=2i=3
Time
O(n²) or O(1)
Space
O(n²) or O(1)

Spot it when

  • Two players taking turns optimally
  • "Predict the winner" or "Can player 1 win?"
  • Game state reduces on every turn