标签:type int nta for set pre too cti itertools
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]]
import itertools
class Solution:
def permuteUnique(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
return [list(i) for i in set(itertools.permutations(nums))]
标签:type int nta for set pre too cti itertools
原文地址:https://www.cnblogs.com/bernieloveslife/p/9783941.html