Mathematics (JEE)Very hardGATE CS

How many strings of length 6 over {A, B, C} contain neither the substring AA nor the substring BB?

  1. A. 243
  2. B. 239
  3. C. 300
  4. D. 192

Correct answer: B. 239

Track the last letter with a recurrence: a string may append C after anything, but A or B only after a different letter. Option 243 is 3⁵ and ignores both restrictions.

More Permutations, Combinations and Probability questions

Exams that ask this topic