Skip to content
Related Articles

Related Articles

Improve Article

GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 34

  • Last Updated : 26 Dec, 2019

Consider two strings A = “gttctagaa” and B = “ctttggttc”. Let x be the length of the longest common subsequence (not necessarily contiguous) between A and B and let y be the number of such longest common subsequences between A and B.

Then x + y = ____________.
(A) 6
(B) 7
(C) 8
(D) 9


Answer: (A)

Explanation: LCS length is 4:

GTTC
TTTG 

Therefore,

= x+y
= 4+2
= 6 

Check: https://ide.geeksforgeeks.org/QSDLkZ8Qjt

Option (A) is correct.

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :