Data Structures & AlgorithmsModerateGATE CS · ICPC regional

What is the length of the longest strictly increasing subsequence (not necessarily contiguous) of [2, 1, 6, 5, 10, 4, 7, 9, 3, 11, 8]?

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

Correct answer: D. 5

Patience sorting maintains the smallest possible tail of each length; the answer is the number of piles. The longest decreasing subsequence, or the longest contiguous increasing run, is a different quantity.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic