← All problems

Permutations

medium

Given an array nums of unique integers, return all possible orderings of its elements. You may return them in any order.

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]]
Loading...