educative.io

Error in the recursive formula

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]