LeetCode: 46. Permutations

Problem: 46. Permutations

Link: https://leetcode.com/problems/permutations/

Difficulty: Medium

Description:

Given a collection of distinct integers, return all possible permutations.

Example 1:

Input: [1,2,3] Output:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1] ]

Solution: 

Language: Swift

Runtime: 20ms
Memory: 21.1MB

Copy to Clipboard