Mathematics (JEE)Very hardCodeforces Div2 C

How many strings of length 6 over {a, b, c} use all three letters and have no two equal adjacent letters?

  1. A. 96
  2. B. 6
  3. C. 90
  4. D. 192

Correct answer: C. 90

Strings with no equal neighbours number 3 * 2^5 = 96; remove the 6 strings that use only two letters (2 alternating strings for each of the 3 letter pairs), leaving 90.

More Permutations, Combinations and Probability questions

Exams that ask this topic