[LeetCode][Python3] 90. Subsets II
2019. 9. 17. 23:10 |
프로그래밍/LeetCode
Problem :
https://leetcode.com/problems/subsets-ii/
My Solution :
class Solution:
def subsetsWithDup(self, nums):
nums.sort()
ans = [[]]
for i in range(len(nums)):
if i == 0 or nums[i-1] != nums[i]:
size = len(ans)
for j in range(len(ans)-size, len(ans)):
ans.append(ans[j]+[nums[i]])
return ans
'프로그래밍 > LeetCode' 카테고리의 다른 글
[LeetCode][Python3] 142. Linked List Cycle II (0) | 2019.10.01 |
---|---|
[LeetCode][Python3] 647. Palindromic Substrings (1) | 2019.09.25 |
[LeetCode][Python3] 338. Counting Bits (0) | 2019.09.24 |
[LeetCode][Python3] 406. Queue Reconstruction by Height (0) | 2019.09.23 |
[LeetCode][Python3] 739. Daily Temperatures (0) | 2019.09.12 |
[LeetCode][Python3] 401. Binary Watch (0) | 2019.09.05 |
[LeetCode][Python3] 692. Top K Frequent Words (0) | 2019.09.03 |
[LeetCode][Python3] 89. Gray Code (0) | 2019.09.03 |
최근에 달린 댓글 최근에 달린 댓글