Collision Odds for Short Refund Reference Codes
Last updated: November 29, 2026
Quick Overview
A team proposes giving each daily refund a random 6-character alphanumeric reference code shown to users. With about one million refunds a day, estimate the chance of at least one collision and the code length needed to keep it under one in a million per day.
PhonePe
November 29, 20260
0
0 solved
A team proposes giving each daily refund a random 6-character alphanumeric reference code shown to users. With about one million refunds a day, estimate the chance of at least one collision and the code length needed to keep it under one in a million per day.
PhonePe generates huge volumes of human-readable references for refunds, disputes and support tickets, and short random IDs feel safe but collide far sooner than intuition suggests. The interviewer checks the birthday-problem approximation and whether you translate it into a concrete engineering recommendation.
What the Interviewer Expects
- Recognize the birthday problem and set up the pair count
- Use the Poisson approximation $P \approx 1 - e^{-n^2/2N}$
- Compute numbers to the right order of magnitude
- Solve for the code length that meets the target
- Recommend a practical design, not just a number
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- How does the answer change if codes must be unique across a whole year?
- Would you drop easily confused characters like 0/O and 1/I, and what does it cost?
- Why not just use a database sequence number?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
Alphabet: 26 letters plus 10 digits = 36 symbols, uniformly random. Codes are unique per day (the day can be part of the lookup key). n is about refunds per day. We want $P(\text{any collision ...
Approach
With possible codes and draws, the expected number of colliding pairs is . For small per-pair probability, the number of collisions is close to Poiss...