Assume I've got an array:
var arr = [1, 1, 2, 3, 3];
I need to compute all unique possible combinations in order out of this array that use the most numbers possible, provided each is unique. I don't care so much about the values but instead a matrix of indices that match:
[0, 2, 3]
[0, 2, 4]
[1, 2, 3]
[1, 2, 4]
I looked at this answer, however when I do that:
var arr = [1, 1, 2, 3, 3];
console.log(allPossibleCases(arr));
I get:
["1 1 2 3 3"]
Which does make sense according to what that function does, but I've been unable to tweak it enough to suit what I want.
Edit:
Note the part where I said IN ORDER. This is not a complete set of permutations and none of the answers in this question do what I'm asking.