nums holds different values. Return every ordering (permutation) of them, listed in dictionary order of the orderings. For [1, 2, 3]: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1].
Example 1
Input:
all_permutations([1, 2, 3])
Output:
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
Example 2
Input:
all_permutations([7])
Output:
[[7]]
0 <= len(nums) <= 7-100 <= nums[i] <= 100No results yet
Run your code to check it against the examples, or submit to run every test.