GATE Computer ScienceHardGATE CS (PYQ pattern)

In the array [2, 5, 3, 7, 11, 8, 10, 13, 6, 9, 4, 12] the longest strictly increasing subsequences have length 6. How many different index-subsets form such a subsequence?

  1. A. 4
  2. B. 6
  3. C. 5
  4. D. 8

Correct answer: B. 6

Using L[i] and a count C[i] of increasing subsequences of that length ending at i, and summing C over all i with L[i] = 6, gives 6 (confirmed by brute-force enumeration of all subsets). Counting only the tails in the patience table gives one, not six.

More Algorithms questions

Exams that ask this topic