Why it matters
Wildcard matching is common variant. Understanding shapes string DP.
Advertisement
The architecture
dp[i][j] = match s[0..i], p[0..j].
* handles two cases: match zero or more.
Advertisement
How it works end to end
? matches one char.
* matches zero or more.
Space O(m) with rolling.
Recursive with memo works too.