why my code is giving wrong input can you check my code
Print longest common subsequence
Okay the way you are trying to store the answer in v is incorrect, you basically match at every same character which is wrong.
Please see this code https://ide.codingblocks.com/s/275839, we first fill the dp table and then move from bottom right to top left.
The approach is explained here https://www.geeksforgeeks.org/printing-longest-common-subsequence/
is this question can’t be solve by recursion with memorization??
if yes then how
not giving correct input
sorry the above code get updated by another one
this code passes only one test case plzz reply sir
check how u r storing values in ur dp array.
do a dry run on constructed dp array .
sir didn’t get what u are talking about all the 2 test cases pass but only one test case didn’t pass
build ur lcs table by traversing from right to left .and then it will work fine.
didn’t pass any test case
it should be m-1 …
thank a lot sir it works