attempt link : https://ide.codingblocks.com/s/46943
i’m kind of struggling with dp. starting with the questions. would be realy helpful if you could point out my mistake.
question:
PRINT LCS
A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence {A,B,D} is a subsequence of {A,B,C,D,E,F}, obtained after removal of elements C, E and F.
Given two strings A and B of size n and m respectively, you have to print the Longest Common Subsequence(LCS) of strings A and B, where LCS is the longest sequence present in both A and B.
Note: It is gauranteed that there is only one unique longest common subsequence
Input Format:
Two strings A and B.
Constraints:
1 <= n,m <= 10^3
Output Format
Output the LCS of A and B.
Sample Input
abc
acd
Sample Output
ac