Expected flips to get two heads in a row
Asked at Jane Street, Optiver
You flip a fair coin repeatedly.
What is the expected number of flips until you first see two heads in a row (HH)? Follow-up: why is the answer different for the pattern HT?
Show a hint
Set up states by progress toward the pattern: "no progress" and "just flipped a head". Write one equation per state.