2 ms·
Great point that since relative order is fixed, it's just a binary decision. A similar problem (with the same solution described) is "balls and bins" [1]: you
by bobbiechen 7y ago
Great point that since relative order is fixed, it's just a binary decision.
A similar problem (with the same solution described) is "balls and bins" [1]: you have k identical balls and n bins - how many ways are there to place the balls in the bins? It blew my mind in intro to discrete math when we reconsidered the problem with instead of n bins, (n-1) bin dividers. Then simply choose where to place the (n-1) dividers out of (k+n-1) places for all of your objects, and you're done!
[1] https://artofproblemsolving.com/wiki/index.php/Ball-and-urn https://artofproblemsolving.com/wiki/index.php/Ball-and-urn