one test case is not getting passed. Please help me to find the mistake.
The link to the sol is :-
Print LCS problem
int row=r;
int col=c;
string result;
while(row>0 && col>0){
if(a[row-1] == b[col-1]){
result.push_back(b[col-1]);
row--;
col--;
}
else if(dp[row-1][col]> dp[row][col-1])
row--;
else col--;
}
reverse(result.begin(),result.end());
return result;
this is the updated code for printing the lcs string
Thanks for the help. All the testcases are now getting passed
1 Like