class Solution:

    def permuteUnique(self, nums: List[int]) ->List[List[int]]:
        res = []

        def dfs(nums: List, tmp: List):
            if not nums and tmp in res:
                res.append(tmp)
                return
            for i in range(len(nums)):
                dfs(nums[:i] + nums[i + 1:], tmp + [nums[i]])
        dfs(nums, [])
        return res

3a9bce1363b45e7cc49992c881a0095be087f040
<mask token>

class Solution:
    <mask token>

class Solution:

    def permuteUnique(self, nums: List[int]) ->List[List[int]]:
        res = []

        def dfs(nums: List, tmp: List):
            if not nums and tmp in res:
                res.append(tmp)
                return
            for i in range(len(nums)):
                dfs(nums[:i] + nums[i + 1:], tmp + [nums[i]])
        dfs(nums, [])
        return res
