Given an array nums of distinct integers, return all possible permutations of the numbers.
The order of the returned list of permutations does not matter.
Input: nums = [2,4,6]
Output: [ [2,4,6], [2,6,4], [4,2,6], [4,6,2], [6,2,4], [6,4,2] ]
Explanation:
All unique arrangements of 2, 4, and 6.
Input: nums = [5,7]
Output: [ [5,7], [7,5] ]
Explanation:
Two possible orderings.
Input: nums = [9]
Output: [ [9] ]
Explanation:
Only one permutation for a single-element array.
Accepted:
Submission: