All Permutations hard
algorithms

Write a function solution(nums) that returns all permutations of a list of distinct integers, in any order.

Example

solution([1, 2, 3]) → [[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]
solution([1])       → [[1]]
solution.py
💡 Tip: Press Ctrl+Enter to run