Problem in code

heyy, i m trying to find the length of the longest common subsequence but its not giving correct ans, please check;

@Aparna


I have corrected your code. There were some minute mistakes of indexing.
And you didn’t implement the traceback of the the dp array. The question under which this doubt was posted is print-lcs, so i have solved the question according to print-lcs.
I have commented the dp[n][m] which stores the length of the lcs as well.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.