Implement `permutations(arr)` that returns an array of all orderings of the input array's elements. For each position, fix one element as the first and recurse on the rest, so the orderings come out in a predictable sequence. Assume the elements are distinct.
+ 2 hidden tests run on Submit.
The number of permutations is n!. Fixing each element as the head and recursively permuting the rest enumerates them all without duplicates (given distinct inputs). Slicing keeps each recursive call working on its own array.
Run your code to see results.