Placement AptitudeVery hardAmazon OA · CAT

How many binary strings of length 7 contain three consecutive 1's somewhere?

  1. A. 40
  2. B. 81
  3. C. 47
  4. D. 48

Correct answer: C. 47

Count the complement: strings with no 111 satisfy a(n) = a(n − 1) + a(n − 2) + a(n − 3) with a(1) = 2, a(2) = 4, a(3) = 7, giving 13, 24, 44, 81 for n = 4 to 7. So 128 − 81 = 47.

More Permutations, Combinations and Probability (Placement) questions

Exams that ask this topic