#testcase 1 is showing wrong.please check ASAP
Hello @shakul
At line 30 the condition inside if should be if(dp[i][j] == dp[i-1][j-1] + 1 && a[i-1] == b[j-1])
and not if(dp[i-1][j]==dp[i][j-1] && dp[i-1][j]!=dp[i][j])
still not working ,after this change can u look again
Hello @shakul
Now there is nothing wrong in the code.
It might be that at the backend some other max length LCS is stored
Try by exchanging the two else if statements @ line 37 and 41 like this and run your code
else if(dp[i][j-1]==dp[i][j])
{
j--;
}
else if(dp[i-1][j]==dp[i][j])
{
i--;
}