educative.io

Re: the DP solution : for empty pattern, we have one matching

You have below description. But I am not sure why?could you please help to explain why?
It seems, sometimes it might define dp[i][0] = 0; ( I don’t have concrete example in hand now, though.)

// for the empty pattern, we have one matching
for(int i=0; i<=str.length(); i++)
dp[i][0] = 1;