We have A apples, B baskets.
How would you write the algorithm that lists every possible distribution for baskets.
One basket can contain zero or max apples.
For example: A = 6, B = 4 (6 apples, 4 baskets).
d1 = 6 0 0 0
d2 = 5 1 0 0
d3 = 5 0 1 0
d4 = 4 2 0 0
d5 = 3 0 0 3
…….
……
so on….
1 Answer