Data Structures & AlgorithmsHardGATE CS · CAT · MBA placement

How many subsets of the set {1, 2, ..., 10} (the empty set included) contain no two consecutive integers?

  1. A. 144
  2. B. 143
  3. C. 1024
  4. D. 92

Correct answer: A. 144

A bitmask with no two adjacent set bits can be counted by the recurrence a(n) = a(n−1) + a(n−2), which is Fibonacci-like. The empty set is one valid choice, so it is included in the count.

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

Exams that ask this topic