Permutations

Medium

📝 Description

Return all possible permutations of a collection of distinct integers

Input Format

Array of distinct integers

Output Format

List of all permutations

Constraints

1 ≤ nums.length ≤ 6

🔍 Sample Input

[1,2,3]
            

✅ Sample Output

[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run