Approach hintTry it first, then revealHide
Let dp[i][j] say whether the first i characters of the string match the first j of the pattern. A * either matches nothing, reading dp[i][j-1], or absorbs one more character, reading dp[i-1][j].
Let dp[i][j] say whether the first i characters of the string match the first j of the pattern. A * either matches nothing, reading dp[i][j-1], or absorbs one more character, reading dp[i-1][j].