Return all possible permutations of the array elements.
Example 1
Input: nums = [1,2,3]
Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
Explanation: Six permutations of three elements.
Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
Explanation: Six permutations of three elements.
Example 2
Input: nums = [1]
Output: [[1]]
Explanation: One element — one permutation.
Output: [[1]]
Explanation: One element — one permutation.