Data Structures & AlgorithmsHardGATE CS · ICPC regional

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

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

Correct answer: A. 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