Consider two strings A="pqqrr" and B="pqprqrp",let x be the length of the longest sub-sequence between A and B and let y be the number of such common sub-sequences between A and B then 2x+4y= ?
A) 22 B) 20 C)18 D)24
The answer is B) i.e. x=4 and y=3. I have understood how x is equal to 4. But what are the common sub-sequences? I am getting two i.e. "pqqr" and "pqrr". Here I have one doubt. Do i have to count twice for "pqqr" in A? Once for "pqqrr" and another one for "pqqrr".