skip to content

How many ways can 10 identical tickets be assigned to 4 named engineers?

level: middleimportance: nice to knowfreq 22%

answer

  1. identical items, distinct bins
  2. stars for items, bars for dividers
  3. choose which positions hold bars
  4. C(n + k - 1, k - 1)
  5. give one each first, then recount

basics

~20 s

286, by stars and bars: line up 10 identical tickets and 3 dividers, then choose which 3 of the 13 positions are dividers, giving C(13,3) = 286. Requiring every engineer to get at least one ticket gives C(9,3) = 84.

solid answer

~50 s

The tickets are identical and the engineers are distinct, so only the counts per engineer matter - the question is how many solutions `x1 + x2 + x3 + x4 = 10` has in non-negative integers. Stars and bars encodes each solution as a row of 10 stars split by 3 bars: `**|***||*****` means 2, 3, 0, 5. Every arrangement of 10 stars and 3 bars in 13 positions is one assignment, so the count is `C(13, 3) = 286`. If every engineer must get at least one ticket, hand out one each first and distribute the remaining 6 freely: `C(6 + 3, 3) = C(9, 3) = 84`. The formula generalises to `C(n + k - 1, k - 1)` for `n` identical items into `k` distinct bins. If the tickets were distinguishable the answer would instead be `4^10 = 1,048,576`.

go deeper

for a junior

Be ready to recognise that identical items and distinct bins is a different problem from distinguishable items, and to draw the stars-and-bars picture for a small case. Getting the encoding right matters more than recalling the formula.

for a middle

Derive C(n + k - 1, k - 1) from the arrangement of stars and bars rather than quoting it, and handle the at-least-one variant by pre-assignment. Verify the formula on a three-item case you can enumerate before trusting it.

for a senior

Show where the model stops applying: distinguishable items, identical bins, or upper bounds per bin. Flagging that these outcomes are not equally likely, so the count cannot serve as a probability denominator, is the distinguishing move.

for a principal

Own the modelling judgment about whether items really are interchangeable in the domain at hand. Be ready to say when a closed-form count is worth pursuing and when constraints have grown tangled enough that enumeration or simulation is the honest answer.

## What makes this a distinct counting problem The defining features are that the **items are identical** and the **bins are distinct**. Ten support tickets that are interchangeable, four engineers who are not. Under those conditions an assignment is fully described by the tuple of counts `(x1, x2, x3, x4)` with `x1 + x2 + x3 + x4 = 10` and every `xi >= 0`. So the counting question becomes: how many non-negative integer solutions does that equation have? ## The stars-and-bars encoding Draw the 10 tickets as stars in a row and separate the four engineers' shares with 3 bars: ``` **|***||***** -> (2, 3, 0, 5) |*****|*****| -> (0, 5, 5, 0) **********||| -> (10, 0, 0, 0) ``` Every arrangement of 10 stars and 3 bars encodes exactly one assignment, and every assignment produces exactly one arrangement - a bijection. Empty groups (two adjacent bars, or a bar at an end) are legal and correspond to an engineer receiving nothing. Counting the arrangements is now easy: there are `10 + 3 = 13` positions, and choosing which 3 hold the bars determines everything. ``` C(13, 3) = (13 x 12 x 11)/(3 x 2 x 1) = 286 ``` ## The general formulas For `n` identical items into `k` distinct bins, using `k - 1` bars: ``` non-negative solutions: C(n + k - 1, k - 1) = C(n + k - 1, n) ``` If every bin must receive **at least one** item, pre-assign one item to each bin and distribute the remaining `n - k` freely. Substituting `yi = xi - 1` turns the constraint back into the non-negative case: ``` positive solutions: C(n - 1, k - 1) ``` Here that is `C(9, 3) = 84`. Note `84 < 286`, as it must be - the at-least-one requirement is a restriction. A lower bound other than 1 works the same way. "Each engineer gets at least 2" means pre-assigning 8 tickets and distributing 2 freely: `C(2 + 3, 3) = C(5, 3) = 10`. ## Sanity-check it on a case you can enumerate Three identical tickets, two engineers: the formula gives `C(3 + 1, 1) = 4`, and by hand the assignments are `(3,0), (2,1), (1,2), (0,3)` - four. Doing this check out loud in an interview is worth more than confidently quoting the formula, because the `n + k - 1` and `k - 1` slots are exactly where people mis-remember it. ## The same formula from a different direction Stars and bars is also the count for **unordered sampling with replacement**: choosing `k` items from `n` types where a type may be chosen repeatedly and only the multiset matters is `C(n + k - 1, k)`. The two statements are the same bijection viewed from either side - "how many of each type did I take" is exactly a tuple of non-negative counts summing to the number of picks. Being able to state that connection is a good signal. A caution carried over from that view: these outcomes are **not equally likely**. If the tickets were assigned by independent uniform random choice, each of the `4^10` distinguishable assignments would be equally likely, but the 286 count-tuples would not be - `(10,0,0,0)` arises one way while `(3,3,2,2)` arises in vastly more. Stars and bars answers a counting question, not a probability question. ## When it does not apply - **Distinguishable items, distinct bins:** each item independently picks a bin, giving `k^n`. Ten distinct tickets among 4 engineers is `4^10 = 1,048,576`, not 286. - **Identical items, identical bins:** now `(10,0,0,0)` and `(0,0,0,10)` are the same outcome and you are counting integer *partitions* of 10 into at most 4 parts. There is no simple closed form; this is a genuinely harder object. - **Upper bounds on a bin** ("no engineer takes more than 4") need inclusion-exclusion on top of stars and bars; the plain formula over-counts. ## Common mistakes 1. **Using `4^10`** when the items are identical - the single most common error, and it is off by four orders of magnitude. 2. **Writing `C(10, 4)`**, which counts choosing 4 things from 10 and has nothing to do with the question. 3. **Mis-placing the offsets** as `C(n + k, k)` or `C(n + k - 1, k)` in the bins framing - check against the 3-tickets-2-engineers case. 4. **Forgetting that bins may be empty**, or conversely applying the positive-solution formula when zeros are allowed. ## The compact answer "Identical items, distinct bins: stars and bars. Ten stars, three bars, thirteen positions, choose the bar positions: `C(13,3) = 286`. With everyone guaranteed one ticket, hand out four first and repeat on six: `C(9,3) = 84`."

  • What changes if the 10 tickets are distinguishable rather than identical?
    Every ticket independently picks one of the 4 engineers, so the count is 4^10 = 1,048,576. Stars and bars no longer applies because the identity of each ticket matters, not just how many each engineer holds. The gap between 286 and about a million is a good reminder to check whether items are interchangeable before choosing a formula.
  • How many assignments give every engineer at least one ticket?
    84. Hand out one ticket to each of the 4 engineers first, leaving 6 to distribute with no constraint: C(6 + 4 - 1, 4 - 1) = C(9, 3) = 84. Equivalently substitute yi = xi - 1 to turn the positive-solution problem back into the non-negative one, giving the general form C(n - 1, k - 1).
  • How does stars and bars relate to sampling with replacement when order does not matter?
    They are the same count. Choosing k items from n types with repetition allowed, caring only about the multiset, is C(n + k - 1, k) - because 'how many of each type I took' is precisely a tuple of non-negative counts summing to k. One phrasing distributes items into bins, the other draws items from types, and the bijection is identical.
  • What breaks if an upper limit is placed on how many tickets one engineer may receive?
    The plain formula over-counts, because it happily allows an engineer to take all 10. You need inclusion-exclusion: count all solutions, subtract those where one specified engineer exceeds the cap, add back those where two do, and so on. Lower bounds are easy by pre-assignment; upper bounds are not.

Think of a row of interchangeable coins and a few dividers slid in between them. You are not arranging the coins - they are all the same - you are only deciding where the dividers go.

saying these in an interview costs you the question

  • Uses 4^10 even though the tickets are identical
  • Writes C(10,4) as if choosing engineers
  • Assumes every bin must receive at least one item
  • Mis-remembers the offsets as C(n+k, k)
  • Applies the formula when the bins are also identical
  • Treats the 286 outcomes as equally likely

context