The interview problem

Practice prompt

Choose a sample size for a bounded metric without assuming a normal distribution.

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

For independent Xi in [0,1], Hoeffding gives P(|mean−E[mean]|≥ε)≤2exp(−2nε²). Solve for n≥log(2/δ)/(2ε²). State independence and fixed sampling before using the bound.

2. Trace the design or derivation

Metric bounds
  → target deviation
  → tail inequality
  → sample size

For a [0,100] metric, rescale to [0,1] or include the squared range in the exponent. A five-point tolerance corresponds to ε=0.05 after rescaling. More data cannot repair a biased sampling frame, so coverage of the target population remains a separate requirement.

3. Calculate the example

With ε=0.05 and δ=0.05, n≥log(40)/0.005≈737.78, so use at least 738 samples. This is a sufficient bound and can be conservative.

4. Failure cases and trade-offs

Unbounded losses and dependent sessions do not fit the simple formula. Repeatedly checking the same fixed-time bound until it passes changes the guarantee.

5. Validation, follow-ups and self-review

Verify the rounded-up sample size in the inequality. Follow-up: how would a [0,100] scale change the formula? Self-review: include range, confidence and stopping rule.

Sources and related practice

Technical reference: www.stat.cmu.edu — Hoeffding bound for independent bounded variables.

Source publication/update: 2021 course. 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 Monitor experiments without treating every peek as a fixed test; Diagnose selection bias in logged recommendation data.

Continue your preparation

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