Intuition
This is a standard balls-into-bins problem. We make the following assumptions:
- Each ball must be placed into exactly one bin.
- The bins are unordered (i.e., permutations of bins are considered equivalent).
Given these assumptions, a backtracking approach is appropriate. However, before discussing the implementation, it is important to recognize that there are two equivalent perspectives from which the backtracking can be formulated. Specifically, we can structure the search by:
1/3/26About 4 min
