Lets say i have an array with 3 numbers:
[1,2,3]
I want to find all combinations of this 3 numbers where all the numbers are included.
Output should look like this:
[1,2,3], [1,3,2], [3,1,2], [3,2,1], [2,3,1], [2,1,3]
Lets say i have an array with 3 numbers:
[1,2,3]
I want to find all combinations of this 3 numbers where all the numbers are included.
Output should look like this:
[1,2,3], [1,3,2], [3,1,2], [3,2,1], [2,3,1], [2,1,3]
It's a bit brute force, but if you're only going to have to do this for a list of three elements, this is simple enough.
a = [1, 2, 3]
a_comb = [[a[0],a[1],a[2]], [a[0], a[2], a[1]], [a[2], a[0], a[1]], [a[2], a[1], a[0]], [a[1],a[0],a[2]], [a[1],a[2],a[0]]]