or or
Intuition
Best visualized if you think of the item pool being selected like:
Where:
- Elements are arranged left to right in the boxes starting from element id 1 to element id n
- Bars tell us when to stop placing our current element and move onto the next element
Note that there can be at most bars as you cannot have a partition with no category.
Then, if we add these bars into our element pool, you get:
Then the combinations are:
Stars and Bars for Sums Of Numbers
Used to find the number of solutions to an equation.
Example
If for example you have , to find all possible solutions you can do: