Calculate Expected Streaks in Coin Toss Sequence
Expected Number of Streaks in Coin Tosses
Scenario
You toss a coin repeatedly. A "streak" (a run) begins on the first toss and whenever the current toss differs from the immediately previous toss.
Task
-
For 1,000 tosses of a fair coin, compute the expected number of streaks.
-
Generalize the expected number of streaks for a biased coin where the probability of heads is p.
Assumptions: Tosses are independent; a streak starts on the first toss.
Hints
-
Use an indicator for a change between toss i and i+1.
-
Apply linearity of expectation.
Constraints & Assumptions
-
Preserve the scope, facts, inputs, and requested outputs from the prompt above.
-
If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it.
-
Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate.
Clarifying Questions to Ask
-
Clarify the random variables, distributional assumptions, independence assumptions, and desired output.
-
Show enough derivation for the interviewer to follow the reasoning.
-
Explain how you would validate the result with simulation or sensitivity checks.
What a Strong Answer Covers
-
A correct setup with definitions, formulas, and boundary conditions.
-
A step-by-step derivation or estimation plan.
-
Interpretation of the result, including uncertainty and practical limitations.
-
Checks for assumptions, edge cases, and numerical stability.
Follow-up Questions
-
How would the result change if the assumptions were relaxed?
-
Can you verify the answer with a simulation?
-
What is the most likely source of estimation error?