Back to DashboardUpgrade
Pro pattern
Upgrade to Pro to access this pattern and all 22 patterns.
PATTERN
Dynamic Programming (2D)
Extend DP to two-dimensional state spaces: grid path counting, two-string comparison (LCS, edit distance), and 2D knapsack variants. Master the dp[i][j] table, understand how to set up base cases for rows and columns, and optimize space with rolling arrays.
Learn Dynamic Programming (2D)Explanation, templates & reference
Unique Paths
medium
Longest Common Subsequence
medium
Coin Change II
medium
Edit Distance
hard
Target Sum
hard
Longest Increasing Path in a Matrix
hard