1
2
3
4
5
6
7
8
|
from itertools import permutations
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
ans=[]
for i in permutations(nums) :
if list(i) not in ans:
ans.append(list(i))
return(ans)
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
codeforces 1294A - Collecting Coins (0) | 2022.05.12 |
---|---|
codeforces 785A - Anton and Polyhedrons (0) | 2022.05.12 |
codeforces 1030A - In Search of an Easy Problem (0) | 2022.05.11 |
leetcode 1679. Max Number of K-Sum Pairs (0) | 2022.05.04 |
leetcode 844. Backspace String Compare (0) | 2022.05.02 |
댓글