# Permutations II (Leetcode 47)

Problem Link: <https://leetcode.com/problems/permutations-ii/>

```python
class Solution:
    def permuteUnique(self, nums: List[int]) -> List[List[int]]:
        
        if(len(nums)==1):
            return [[nums[0]]]
        
        d={}
        ans=[]
        for i in range(len(nums)):
            if(nums[i] in d):
                continue
            else:
                d[nums[i]]=1
                char=nums[i]
                ros=nums[:i]+nums[i+1:]
                tempAns=self.permuteUnique(ros)
                for i in tempAns:
                    i.insert(0,char)
                    ans.append(i)
        return ans
```
