Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional
Using each of [1, 2, 4, 16] at most once, what is the smallest positive integer that cannot be written as a sum of distinct elements of this list?
- A. 8
- B. 9
- C. 16
- D. 32
Correct answer: A. 8
Without the 8, the subset sums of 1, 2 and 4 reach only 1 through 7, so 8 is the first gap.
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
- What is the exponent of 3 in the prime factorisation of 30!?
- Items of size 6, 5, 4, 3, 2 must be packed into bins of capacity 10 using first-fit decreasing. How many bins are used?
- How many substrings of "abcabc" are anagrams of "abc" (that is, have the same letters with the same counts)?
- What is the total number of 1-bits in the binary representations of all integers from 0 to 31 inclusive?
- How many integers from 1 to 100 inclusive are perfect squares or perfect cubes?
- What is the minimum number of single-character replacements needed to make "abcdba" a palindrome?