← 返回 google 的题目列表Permutations II
类型:online_judge
Permutations II
Given an array nums that may contain duplicate integers, return all unique permutations. The order of returned permutations does not matter.
Example 1
Input: nums = [1,1,2]
Output: [[1,1,2],[1,2,1],[2,1,1]]
Example 2
Input: nums = [1,2,3]
Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1],[3,2,1]]
Constraints
1 <= len(nums) <= 8
-10 <= nums[i] <= 10
The output must not contain duplicate permutations.
Example
Input
1 1 2
Output
[1,1,2]
[1,2,1]
[2,1,1]