Data Structures & AlgorithmsVery hardICPC regional · Codeforces Div 2

How many integers x in [0, 1023] have no two adjacent 1 bits in their 10-bit binary form?

  1. A. 128
  2. B. 89
  3. C. 233
  4. D. 144

Correct answer: D. 144

Strings of length 10 with no adjacent 1s are counted by Fibonacci numbers: F(12) = 144. The power-of-two guess 128 and F(11) = 89 both miss the recurrence.

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

Exams that ask this topic