Longest Common Subsequence

what is wrong with this code:

hello @Codemaniac_Aditya
the issue is with this part of the code
image

it will push all such character which are common in both the strings without considering their order.
for ex->
input ->
aebcd
cde
output
ecd
which is clerly not a lcs.

refer this article->https://www.geeksforgeeks.org/printing-longest-common-subsequence/

1 Like