Expected number of steps of a random process, in code and math
MediumConcept20 minSWEREMLEPro outline
The question
You roll a fair six-sided die until you get two sixes in a row. On average, how many rolls does that take?
Derive it, then write a quick simulation to check your answer.
What the interviewer is looking for
- Sets up states and expectation equations
- Solves them correctly
- Writes a correct simulation with a seed
- Compares simulation to theory with a sense of error
Your answer
Saved in this browser only. Nobody else sees it.
Why this question
Written by BlogLLM in the style of a publicly reported OpenAI question type: probability and math in code: KL divergence for continuous distributions, or expected iterations of a random process.
Reported in: interviewing.io
Practice question written by BlogLLM based on publicly reported interview formats. Not an official OpenAI question.