Let's say I= have 5 sweets and I want to find all possible combinations of sharing them among my 3 kids.
This will be like something below:
5 for kid_A, 0 for kid_B, 0 for kid_3
0 for kid_A, 5 for kid_B, 0 for kid_3
....
4 for kid_A, 1 for kid_B, 0 for kid_3
4 for kid_A, 0 for kid_B, 1 for kid_3
....
and so on
Is there an algorithm to find this combinations?
So far, I have managed to compute the first 3 combinations, where I give all my sweets to one of my kids, and the remaining get 0; but I'm lost on how to divide once I'm done with this first iteration.