# class Solution: def subsets(self , nums: List[int]) -> List[List[int]]: # write code here res,path = [], [] nums.sort() n = len(nums) def dfs(i:int): res.append(path.copy()) for j in range(i,n): if j>i and nums[j-1]==nums[j]: continue path.append(nums[j]) dfs(j+1) path.pop() dfs(0) return res