Lcs print with stack

Which test case are failing?

Please provide the link of your code in coding blocks IDE

There is some error in the logic of your code in the lines 26-36. Rest of the code is fine.
Try again and tell me if you are able to debug your code.
We start from dp[n1][n2] and compare dp[i-1][j] with dp[i][j-1].
If they are equal and dp[i][j] ! = dp[i-1][j], we first decrement i and j and then push str1[i] in our stack.
If they are equal and dp[i][j] = dp[i-1][j], we decrement j.
Else we decrement i or j if dp[i][j] = dp[i-1][j] or dp[i][j] = dp[i][j-1] respectively.
We do this till i!=0 && j!=0

@coolio.boy385 Please mark your doubt as resolved if you are satisfied.

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.