Print lcs regarding doubt

in the video at 5:46 bhaiya said that if dp[x-1][y] is equal to dp[x][y-1] and its equal to the dp[x][y] then go in any direction but if im going in upward direction its passing all the test cases but if im going in left direction its not passing all the test cases why?

@deepakjumani09
please share your code ide link

at line 54 if eual is not there its passing all test cases

@deepakjumani09 don’t worry actually your code is right, but the problems seems to be that since it is possible that there are multiple LCS of same length for given strings so here the submission is not checked for different possibility of the answer.
I will let you know after checking it once again.

in question there is written that it is guranted that there is only one lcs

@deepakjumani09 You can try submitting it now, both of codes codes will work.
Also mark the doubt as resolved after verifying it.

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.