I need c++ code which will generate all possible combinations (n,k) with repitions
where n – num of integers in the input array.
k – num of positions
for example
Input:
n = [1 2 3];
k = 2;
Output:
A3 =
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
Thanks.
See my answer here :
PHP take all combinations
It’s PHP; but the concept (recursion, etc) should be easily “translateable”…