Data Structures & AlgorithmsHardGATE CS

How many subsets of {1, 2, ..., 15} (including the empty set) contain no two consecutive integers and have an even sum?

  1. A. 792
  2. B. 798
  3. C. 805
  4. D. 820

Correct answer: C. 805

There are 1597 subsets with no two consecutive integers (Fibonacci F17), and enumeration shows 805 of them have an even sum; the empty set counts. The remaining 792 have odd sum, so the split is not exactly even.

More Coding Interview Problems questions

Exams that ask this topic