Data Structures & AlgorithmsVery hardICPC regional · GATE CS

How many permutations of the numbers 1 to 6 have a longest increasing subsequence of length exactly 3?

  1. A. 181
  2. B. 401
  3. C. 61
  4. D. 381

Correct answer: D. 381

This is a counting problem solved by a Robinson–Schensted style argument or by enumeration: a permutation of 6 has at most 720 orders, and the LIS length is computed for each. Guessing from the Catalan numbers is a common slip.

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

Exams that ask this topic