Data Structures & AlgorithmsVery hard
How many NON-EMPTY subsequences of 3 1 4 1 5 9 (position subsets read in order) are STRICTLY increasing?
- A. 31
- B. 21
- C. 27
- 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.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many NON-EMPTY subsequences of 2 3 4 7 8 5 (position subsets read in order) alternate in parity, so that each chosen value has the…
- How many subsequences of EXACTLY three elements of 1 4 2 5 7 9 6 (position subsets read in order) form an arithmetic progression (the…
- How many NON-EMPTY subsequences of 2 5 3 8 6 1 (subsets chosen by position) have (maximum − minimum) exactly 3?
- How many NON-EMPTY subsets of 1 2 3 4 5 6 7 have bitwise XOR equal to 0?
- How many subsets of exactly two elements of 2 4 5 7 9 10 12 (position pairs) have a sum divisible by 3?
- How many subsequences of EXACTLY four elements of 1 2 3 4 5 6 7 (position subsets) sum to 16?