Comment body goes here.
Your code must have the space complexity of nm.
Try reducing it to 2m.
where m is length of string B
I was getting the same error. Then I changed my integer dp[n][m] array to boolean, it got accepted.
I was getting the same error.Just initialize dp[m][n] as a vector,not as array.
Just try to look at it we just require the previous row, now dp can be reduced to
make your int 2d array vector<vector>
memory and time restrictions are tight.
use a dp of 2*(a.size()) length. because you only need the elements of the previous column so no need to have another vector the size of string b
time should be o(m*n)