Given buckets of unique numbers, how do we generate all combinations where you choosing a number from each bucket only once.
For example, if given {1,12,3} and {4,22,6} the answer is:
1/4 12/22 3/6
1/4 12/6 3/22
1/22 12/4 3/6
1/22 12/6 3/4
1/6 12/4 3/22
1/6 12/22 3/4
Of course, we don't just want 2 buckets, but n buckets. And each bucket can contain any amount of numbers; the numbers are unique across buckets.
Any algorithm in c# would be appreciated. I would expect the result to be something like: List<List<int[]>>
Thanks!