subset with duplicate
class Solution:
def subsetsWithDup(self, nums):
if not nums:
return []
nums.sort()
res, cur = [[]], []
for i in range(len(nums)):
if i > 0 and nums[i] == nums[i-1]:
cur = [item + [nums[i]] for item in cur]
else:
cur = [item + [nums[i]] for item in res]
res += cur
return res