```
class Solution:
# @param num, a list of integer
# @return a list of lists of integer
# 1:02
def __init__(self):
self.output = []
def subsetsWithDup(self, S, pos = 0, temp = None):
temp = temp or []
S.sort()
if temp not in self.output:
self.output.append(temp[:])
for i in range(pos, len(S)):
temp.append(S[i])
self.subsetsWithDup(S, i+1, temp)
temp.pop()
return self.output
```