I'm looking to create a JavaScript script that can work out permutations, no duplicates or singles, so an array of numbers with 0, 1, 2 and 3 should return:
Code:
01, 02, 03, 12, 13, 23
012, 013, 023, 123
0123
The actual script will do something once it reaches a permutation, so 23 would actually be used to access two items in an array at positions 2 and 3 and return a value based on these values.
Now recursion is a topic I have never got my head around and I think it's probably going to be the answer to this post so any help would be appreciated.