Data Structures & AlgorithmsVery hard

How many NON-EMPTY subsequences of 3 1 4 1 5 9 (position subsets read in order) are STRICTLY increasing?

  1. A. 31
  2. B. 21
  3. C. 27
  4. D. 28

Correct answer: C. 27

A subsequence is read in index order, so it is strictly increasing when each chosen value exceeds the one before it. Allowing equal values, dropping singletons, or testing sortedness of the multiset each change the count.

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

Exams that ask this topic