```
class Solution(object):
def permuteUnique(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
result = []
self.perm(sorted(nums), [], result)
return result
def perm(self, input, path, paths):
if len(input) == 0:
paths.append(path[::])
return
for i in range(len(input)):
if i > 0 and input[i] == input[i - 1]:
continue
path.append(input[i])
self.perm(input[:i] + input[i + 1:], path, paths)
path.pop()
return
```