Create a function that takes an array of numbers and returns an array containing all possible permutations.
permutations([1]) ➞ [[1]]
permutations([1, 7]) ➞ [[1, 7], [7, 1]]
permutations([2, 4, 7]) ➞ [[2, 4, 7], [2, 7, 4], [4, 2, 7], [4, 7, 2], [7, 2, 4], [7, 4, 2]]
All given arrays do not contain duplicates.