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?

  1. A. 8
  2. B. 9
  3. C. 16
  4. 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.

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

Exams that ask this topic