Given two strings A and B. Find the longest common sequence ( A sequence which does not need to be contiguous),
which is common in both the strings.
You need to return the length of such longest common subsequence.
Your code will be run on multiple test cases (<=10). Try to come up with an optimised solution.
1 <= Length of A, B <= 10^3 + 5
A : "abbcdgf" B : "bbadcgf"
The longest common subsequence is "bbcgf", which has a length of 5
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.