Mathematics (JEE)Very hardCodeforces Div2 C
How many words of length 6 over the alphabet {a, b, c} contain neither the substring aa nor the substring bb?
- A. 729
- B. 239
- C. 96
- D. 448
Correct answer: B. 239
Let a_n, b_n, c_n count valid words of length n ending in a, b, c: a_n = b_{n-1} + c_{n-1}, b_n = a_{n-1} + c_{n-1}, c_n = a_{n-1} + b_{n-1} + c_{n-1}. Starting from (1,1,1) this gives totals 7, 17, 41, 99 and 239 at length 6.
Practise more Permutations, Combinations and Probability questionsPermutations, Combinations and Probability: notes and key points
More Permutations, Combinations and Probability questions
- How many partial orders (reflexive, antisymmetric and transitive relations) are there on the labelled set {1, 2, 3, 4}?
- How many relations R on the set {1, 2, 3} are transitive, meaning that whenever (a,b) and (b,c) are in R, then (a,c) is also in R?…
- How many functions f from {1, 2, 3, 4, 5} to itself satisfy f(f(x)) = f(x) for every x?
- How many functions f from {1, 2, 3, 4} to {1, 2, 3, 4, 5} are non-decreasing, meaning f(1) <= f(2) <= f(3) <= f(4)?
- How many functions f from {0, 1, 2, 3, 4, 5} to itself satisfy f(f(x)) = x for every x?
- How many ways are there to partition the set {1, 2, 3, 4, 5, 6, 7} into exactly 3 blocks, where every block has at least 2 elements? The…