GATE Computer ScienceHardGATE CSE · IBPS SO

How many strings of length 10 over {a, b} have no three consecutive equal symbols (neither aaa nor bbb)?

  1. A. 198
  2. B. 164
  3. C. 178
  4. D. 110

Correct answer: C. 178

Runs have length 1 or 2, so counts follow 2 × Fibonacci: length n gives 2F(n+1): lengths 1.. give 2, 4, 6, 10, 16, 26, 42, 68, 110, 178 → 178.

More Theory of Computation questions

Exams that ask this topic