What this combinatorics interview question tests
This is an easy combinatorics problem that appears in probability and statistics interview rounds. It asks you to count the number of ways to distribute indistinguishable items (donuts) into distinguishable categories (types) subject to a constraint (at least one of each type).
The core skill is recognizing when a problem is asking for compositions with constraints rather than raw permutations. Since order doesn't matter—only the final count of each type in the box—you need to think in terms of how many donuts of each type to include. The constraint that every type must be represented rules out many naive distributions and forces you to account for that systematically.
- Stars and bars (distributing indistinguishable objects into distinguishable bins)
- Constraint-handling via change of variables
- The difference between ordered and unordered selections