Engineering MathematicsVery hardGATE CS (PYQ pattern)

A fair coin is tossed repeatedly. What is the expected number of tosses until the pattern H T H H first appears?

  1. A. 16
  2. B. 18
  3. C. 20
  4. D. 14

Correct answer: B. 18

Add 2^k for every k at which the length-k prefix of the pattern equals its length-k suffix: k = 4 (the whole pattern) and k = 1 (H = H). So 16 + 2 = 18.

More Engineering Mathematics (GATE) questions

Exams that ask this topic