Can you find all the cases where, if I put 3 balls into 2 boxes
the case is
1 1 1 1 1 2 1 2 2 2 2 2
the columns stand for a ball, the number stands for box, and the row stands for a case.
So we have 4 cases
You should write a function, input m and n, m stand for the number of balls, n stands for the number of boxes, output all the cases.
Example
If m = 3, n = 4 then you should output
1 1 1 1 1 2 1 1 3 1 1 4 1 2 2 1 2 3 1 2 4 1 3 3 1 3 4 1 4 4 2 2 2 2 2 3 2 2 4 2 3 3 2 3 4 2 4 4 3 3 3 3 3 4 3 4 4 4 4 4
I don't think you have a complete statement of the problem. Why, in the first example, are arrangements like 1 1 2 excluded? And you only accept the arrangements in a particular order. How do you define the order?
the data ascended by column,when the first column is the same, sort by the second column,...
Thanks - and I realize now that 1 1 2 is not excluded; I just wasn't looking carefully.
2729 Solvers
Remove all the words that end with "ain"
1027 Solvers
7680 Solvers
535 Solvers
82 Solvers