Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

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

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

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