All Posts

1276 articles

dsa1 min read

Regular Expression Matching — 2D DP

Match string s against pattern p with . and *. dp[i][j] = does s[:i] match p[:j]. Handle * by matching zero or more of preceding char.

Read →
dsa1 min read

Wildcard Matching — 2D DP

Match string with wildcard pattern: ? matches any char, * matches any sequence. Similar to regex but * matches any sequence (not zero/more of preceding).

Read →
dsa1 min read

Dungeon Game — Reverse Grid DP

Find minimum initial health to reach bottom-right dungeon cell. Solve backwards: dp[i][j] = min health needed at (i,j) to survive.

Read →
dsa1 min read

Ones and Zeroes — 2D 0/1 Knapsack

Find maximum strings using at most m zeros and n ones. 2D 0/1 knapsack: dp[i][j] = max strings using i zeros and j ones.

Read →
Page 42 of 256