im not passing 1 test case i think my LCS fn is right. problem is in printing plz tell me the prblm
Print LCS doubt
updated made in the part where u were printing the LCS
if im changing the while condn of ur code to pos>=0 it is totally like my code and its working fine but im not understanding why my code is not working https://ide.codingblocks.com/s/231459
https://ide.codingblocks.com/s/231607 (this code is correct)
comments to where updates are made
for i/p
qwertyuioplmznchskalcmnbxghfjtklmnzxcbvnmjkanslpaoutrinvmakldkslqwertyuioplmznchskalcmnbxghfjtklmnzxcbvnmjkanslpaoutrinvmakldkslqwertyuioplmznchskalcmnbxghfjtklmnzxcbvnmjkanslpaoutrinvmakldkslqwertyuioplmznchskalcmnbxghfjtklmnzxcbvnmjkanslpao
lakdmshvndmxnvjrtyuiopqwertlakdmshvndmxnvjrtyuiopqwertdkslpensismfnvheksndertdkslpensismfnvheksndertdkslpensismfnvheksnd
ur o/p
lmshvnmnvrtyuioplmshvnmnvrtyuioplnsmnhknkslpinvkdksleismfnvkn
required
lakmvnmnvrtyuioplakmvnmnvrtyuioplnsmfnvksndksleimnhkntklmnvks
in line why there is not a equal in if condn
(dp[x-1][y] > dp[x][y-1])
we usually give more prefernce to the upper row hence we do x-- in case > sign
i dont think this would create a difference
but if it does then that could be thought of a convention
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.