Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
How many non-empty subsequences of [2, 3, 5, 7] have a product strictly less than 50?
- A. 15
- B. 10
- C. 4
- D. 12
Correct answer: D. 12
Enumerate all 15 non-empty subsets: 4 singletons, all 6 pairs (largest 35) and the triples 30 and 42 are below 50, while 70, 105 and 210 are not: 12. Forgetting the triples gives 10, 4 counts singletons and 15 every subset.
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
- In how many ways can [1, 2, 3, 0, 3] be cut into 3 non-empty contiguous parts such that all three parts have equal sum?
- What is the length of the longest contiguous subarray of [1, 5, 6, 2, 8, 3] whose maximum minus minimum is at most 3?
- Meetings occupy the half-open intervals [s, f) listed as (1,2), (3,4), (0,6), (5,7), (8,9), (5,9). Only one meeting may use the room at a…
- Children have greed factors [1, 2, 3] and cookies have sizes [1, 1]. A child is content if assigned a cookie of size at least their greed…
- From the digit string "1432219" remove exactly 3 digits (keeping the remaining digits in their original order) so that the resulting…
- How many contiguous substrings of "abcabc" contain exactly 2 distinct letters?