What the stars and bars method does
A stars-and-bars problem treats each identical item as a star and each divider between containers as a bar. The count becomes a combinations problem over the positions in one line.
The standard formula
If identical items go into distinct containers, the total number of distributions is inom{n+k-1}{n}.
Common uses
This appears in distributing candies, allocating resources, and counting non-negative integer solutions to equations like .