The interview problem

Practice prompt

How many independent draws are needed on average to see every equally likely category?

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

After i of n categories have appeared, a new one arrives with probability (n−i)/n. Sum geometric waiting expectations n/(n−i) to get nH_n. This is expected full coverage, not a high-probability deadline.

2. Trace the design or derivation

Observed category count
  → new-category probability
  → geometric stages
  → sum

A union bound gives P(any unseen after t draws)≤n(1−1/n)^t. It can be loose, but it separates an expectation from a coverage guarantee. For interview practice, state which planning question the user actually asked before choosing the calculation.

3. Calculate the example

For four categories, 4×(1+1/2+1/3+1/4)=25/3≈8.33 draws. The last missing category alone takes four draws on average.

4. Failure cases and trade-offs

Unequal category frequencies can make rare categories dominate. Adaptive collection or draws without replacement follow different models.

5. Validation, follow-ups and self-review

Simulate small n and compare means over repeated experiments. Follow-up: how would you bound the probability of any missing category? Self-review: explain stage waiting times.

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 Derive waiting time for independent successes; Keep a uniform sample from an unknown-length stream.

Continue your preparation

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