TL;DR
Stars and Bars: Count ways to put n identical balls into k distinct bins: C(n+k-1, k-1). This concept is essential for quantitative trading interviews and is frequently tested at top firms.
By Valenke Exam Prep Team·Last updated 2026-06-01
Combinatorics
Stars and Bars
Count ways to put n identical balls into k distinct bins: C(n+k-1, k-1).
Stars and bars (also "balls in bins") counts the number of ways to distribute identical objects into distinct bins.
Intuition: Line up stars (the objects) and insert bars (dividers) among them. Everything to the left of the first bar goes in bin 1, between bars 1 and 2 goes in bin 2, and so on. The total number of symbols is , and you choose where to place the bars.
Formula (non-negative bins):
Concrete example: Distribute 5 identical candies among 3 children.
We need to place bars among positions:
One distribution: means child 1 gets 2, child 2 gets 3, child 3 gets 0.
Variant (positive bins): If each bin must have at least 1 object, pre-place one object in each bin. Then distribute the remaining among bins:
When to use: "How many non-negative integer solutions does have?" This is the same problem in disguise. Also: distributing identical items, counting multisets, and partitioning integers with an upper bound on parts (with inclusion-exclusion).
Alternative approach: Stars and bars is itself a fundamental technique. Many occupancy and distribution problems reduce to it.
Ready to practice for the Valenke Finance Exam?
Adaptive practice powered by Item Response Theory targets your weak areas. Start with 3 free sessions.
Start free practice →