What this digit-probability interview question tests
This is a medium-difficulty probability question that quant interviewers use to assess whether you can think strategically about counting and complementary events. Rather than enumerate all integers containing a 7 (which is tedious and error-prone), the elegant approach uses the complement: find the probability that a random integer does not contain the digit, then subtract from 1.
The question rewards clarity of setup and confidence in approximation. You'll need to think carefully about how many digits each range of integers has, and how many ways you can form a number using only a restricted digit set. Interviewers care that you spot the structure of the problem and execute a clean calculation—not that you memorize a formula.
- Complementary probability and symmetry
- Counting integers by digit length and constraints
- Exact vs. approximate answers under large ranges