medium
Permutations
Given an array of distinct integers, return all possible orderings of its elements.
Constraints
- 1 ≤ n ≤ 6
- All elements distinct
Examples
in: nums = [1,2,3]
out: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.