logo
Interview
    Interview Guide
    Coding Problems List
Sponsored: Coursera
Problems

Permutations

Problem

Given a list of numbers, return all possible permutations.

Notice: You can assume that there is no duplicate numbers in the list.

Example

For nums = [1,2,3], the permutations are:

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

Online Judge