The interview problem

Practice prompt

How many independent attempts should a worker expect before its first success, and when is that model misleading?

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Let T count attempts including the successful one, with fixed success probability p. P(T=k)=(1−p)^(k−1)p. Sum the tail probabilities to obtain E[T]=1/p. Explicitly distinguish this convention from counting failures before success.

2. Trace the design or derivation

Trial model
  → tail probability
  → expectation
  → capped policy

With at most three attempts, expected attempts are 1+0.8+0.64=2.44, including unsuccessful exhausted runs. Success probability is 1−0.8^3=0.488. These answer different questions and should not be confused with expected attempts conditional on eventual success.

3. Calculate the example

At p=0.2, the mean is 5 attempts. P(T>10)=0.8^10≈0.1074, so a mean of five does not promise success within five or even ten attempts.

4. Failure cases and trade-offs

Correlated outages and changing success probabilities invalidate independent constant-p trials. Unlimited retry assumptions omit timeouts and resource budgets.

5. Validation, follow-ups and self-review

Check p=1 and a finite retry cap. Follow-up: derive expected attempts with at most three tries. Self-review: state the counting convention and independence assumption.

Sources and related practice

Technical reference: docs.scipy.org — Geometric support and probability convention.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Bound retries across a service call chain; Estimate expectations with Monte Carlo.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.