retagged by
2,331 views
0 votes
0 votes
Consider two strings A = "anandarmy" and B = "algorithms". Let ‘y’ be the length of the longest common subsequence (not necessarily contiguous) between A and B and let ‘x’ be the number of such longest common subsequences between A and B. Then 2x+3y = _________.
retagged by

2 Answers

0 votes
0 votes

two strings A = "anandarmy" and B = "algorithms".

remove non common letters, A= aaarm  B = arm

clearly,

LCS: arm

Only one subsequence.

The answer will be 2*1+3*3 = 11.

 

Related questions

2 votes
2 votes
2 answers
1
Pooja Palod asked Dec 1, 2015
9,211 views
For X= BDCABA and Y=ABCBDAB find length of lcs and no of such lcs..(solve it using table method)