i1
and i2
should not be there; also it would be good to have an animation since the tabulation a bit tricky here.
if str[strIndex] == pat[patIndex] {
dp[strIndex][patIndex] = dp[strIndex-1][patIndex-1]
}
dp[i1][i2] += dp[strIndex-1][patIndex]
i1
and i2
should not be there; also it would be good to have an animation since the tabulation a bit tricky here.
if str[strIndex] == pat[patIndex] {
dp[strIndex][patIndex] = dp[strIndex-1][patIndex-1]
}
dp[i1][i2] += dp[strIndex-1][patIndex]