Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

How many subsets (including the empty set, but counting each subset once) of [1, 2, 3, 4] have element sum equal to 5?

  1. A. 3
  2. B. 1
  3. C. 4
  4. D. 2

Correct answer: D. 2

Only {1, 4} and {2, 3} sum to 5; no other subset of [1, 2, 3, 4] does.

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

Exams that ask this topic