When NOT to Use

Avoid forcing this pattern

Avoid forcing this pattern when:

  • Single sequence only: If problem involves only one sequence, 1D DP is sufficient.
  • State can be compressed: Many 2D DP problems only need previous row, reducing to O(n)O(n) space.
  • No optimal substructure in two dimensions: Verify the recurrence requires both dimensions. Remember: forcing a pattern where it doesn't fit leads to overcomplicated solutions.

If you find yourself fighting the approach, step back and reconsider whether another technique works better.