Permutations
Return all permutations of the distinct integers in nums. Result order is unrestricted, but element order inside each permutation is significant.
Example 1
nums = [1,2,3][[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]Explanation
Choosing each of three values once in every position gives six ordered permutations.
Example 2
nums = [7][[7]]Explanation
A singleton has one ordering.
Example 3
nums = [4,9][[4,9],[9,4]]Explanation
[4,9] and [9,4] are distinct permutations.
Constraints
- 1 <= len(nums) <= 6
- Values are distinct
Function contract
permuteArguments: jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 35 cases, on your device.
[1,2,3]