Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

What is the length of the longest strictly increasing subsequence of [10, 9, 2, 5, 3, 7, 101, 18]?

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

Correct answer: B. 4

One longest subsequence is 2, 3, 7, 18 (length 4). The patience-sorting tails array gives the same length in O(n log n).

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic