Failing at two test cases

why is my code failing at two cases.help me identify my error and explain the problem.


Please don’t suggest other codes and reply ASAP.

It has been more than 4 hours ,reply fast…


added comments for mistakes and fixed the logic

First thanks for replying so quickly and secondly your code is not passing all the testcases. So either handover this to some other TA or check before replying so that u can save ur and my time.

else if( dp[m][n-1] == dp[m][n]) //
this else if condition
i had mistyped
dp[m][m]
instead of dp[m][n]


here it is fixed

Would u like to tell me where my code was failing with examples and dry run?


i have added the comments to ur original code here, u can read the comments