LCS recursive solution

In the recursive code in beginning, the checking condition is if ( s1[ i ] == s2 [ I ] ) return 1+ …

should the condition be s2 [ I ] or s2 [ j ] ??

Hey @sonalbera I didn’t get your doubt, can you be little more specific so that I can help you?

If current character in s1[i] and s2[j] are same, then that current character will be part of LCS
That will be represented by dp[i][j] where i is for s1 and j is for s2

I mean that for the recursive approach without DP @7:29 of video, for the if condition in recursive case, bhaiya has written s1[ i ] == s2[ i ] . So I was asking shouldn’t it be s1[ i ] ==s2[ j ] as j is for s2 ?

Yes, it should be s2[j] , have been missed by Bhaiya. But you noticed it, nice work :+1:

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.