Given an array nums of distinct integers, return all possible permutations of the array.
A permutation is an ordering of all elements in the array, and each element must appear exactly once in each permutation.
nums
: an array of integers with no duplicates.
1 <= nums.length <= 10
-10 <= nums[i] <= 10
nums
are unique.
Input: nums = [1,2,3]
Output (one valid ordering):
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]