Please check code for Print LCS problem


Not passing any test case.

hello @sahilkhan2312000131

in this question we have to print LCS string, u r only computing LCS Length.

Please see my code it is printig the lcs

thats wrong way of doing.

it will print output for every state wherever a[i]==b[j]

the idea is to first prepare ur dp table and then use that table to generate lcs string.

Can you share a test case where it works wrong

abc
bad

…
…
…
…
…
or

abc
bac

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.