link to the code
Lcs, my one test case is not working . Help me out
@sanjana23 The conditions for including the character while pushing into stack are not correct.
The actual conditions should be:-
if(s1[i-1]==s2[j-1]){
ans.push(s1[i-1]);
i–;
j–;
}
else if(dp[i-1][j]>dp[i][j-1])
i–;
else
j–;
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.