GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A cyclic binary string of length 12 is written around a circle, so position 12 is followed by position 1. How many of the 2¹² strings contain no three consecutive 0s anywhere around the circle?

  1. A. 1705
  2. B. 1499
  3. C. 1520
  4. D. 1456

Correct answer: B. 1499

Linear strings without 000 number 1705 (tribonacci-type recurrence), but some of them create 000 across the wrap (e.g. ending 00 and starting 0, or ending 0 and starting 00). Checking all 4096 strings with the wrap-around gives 1499. 1705 ignores the wrap-around.

More Algorithms questions

Exams that ask this topic