Subsets / Combinations
LC #46Medium
Permutations
Subsets / Combinations
AmazonGoogleMetaLinkedInMicrosoftProblem
Return all possible permutations of an array of distinct integers.
arraybacktracking
Constraints
- ›1 ≤ n ≤ 6
- ›-10 ≤ nums[i] ≤ 10
- ›All values are unique
Example
Input
nums = [1, 2, 3]Output
[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]Why
3! = 6 permutations. Return in any order