I have many arrays like these, the amounts are dynamic, can be 3, 10, 35 and so on...
[1, 2, 3, 4, 5]
[1, 2, 3]
[1, 2, 3, 4]
...
...
Then I want to create a combination value out of them like these:
[
111, // combine from: first arr idx 0, second arr idx 0, third arr idx 0
112, // idx 0, idx 0, idx 1
113,
114
]
[
121, // idx 0, idx 1, idx 0
122,
123,
124 // idx 0, idx 1, idx 3
]
[131, 132, 133, 134]
[
211, // idx 1, idx 0, idx 0
212,
213,
214
]
[221, 222, 223, 224]
...
...
If the amounts of source arrays are static, lets say always 3, it can be easily to accomplish by using nested for
loop.
But I am struggling to solve this because they are dynamic, sometimes just 2 arrays and other time can be 15 arrays.
Note that the integer values are just examples, I should've used string.