Data Structures & AlgorithmsModerateTCS NQT · CAT · MBA placement
How many strictly increasing sequences of length 4 can be formed from the values 1 to 10 (each sequence uses four distinct values, listed in increasing order)?
- A. 10000
- B. 1048576
- C. 210
- D. 840
Correct answer: C. 210
A strictly increasing sequence is determined entirely by its set of values, so the count is C(10, 4) = 210. Ordered tuples (10·9·8·7 = 5040) overcount, since each set appears once when sorted.
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
- The sorted array [1, 2, 4, 5, 9, 10] is given. What is the smallest positive integer that does NOT appear in it?
- How many DISTINCT strings are produced by taking all cyclic rotations of "abcabcab" (including the original)?
- Process [3, 1, 4, 1, 5, 9, 2, 6] with a stack: before pushing each value, pop while the top is smaller than it. How many pop operations…
- From the number 1, the allowed moves are x -> x+1, x -> x-1 and x -> 2x, staying within [1, 40]. What is the minimum number of moves to…
- In the list [1, 3, 4, 7, 2, 9], how many nodes come strictly before the first node whose value exceeds 5?
- How many index pairs i < j in [3, 5, 6, 1] satisfy a[i] XOR a[j] < a[i]?