GATE Computer ScienceVery hardGATE CS (PYQ pattern)

What is the length of the shortest string over {a, b} that has length divisible by 4, contains both aab and bba, has an odd number of b's and ends with a?

  1. A. 4
  2. B. 8
  3. C. 12
  4. D. 6

Correct answer: B. 8

Search by length (multiples of 4 only): the first success is aaaabbba of length 8.

More Theory of Computation questions

Exams that ask this topic