C++ Easy Solution
\n\n# Code\n\nclass Solution {\npublic:\n    // vector<vector<int>>ans;\n    void f(set<vector<int>>& res,const vector<int>& nums,int pos,vector<int> temp){\n\t
\n\n# Code\n```\nclass Solution {\npublic:\n    // vector<vector<int>>ans;\n    void f(set<vector<int>>& res,const vector<int>& nums,int pos,vector<int> temp){\n\t\tif(pos==nums.size()){\n            sort(temp.begin(),temp.end());\n\t\t\tres.insert(temp);\n\t\t\treturn;\n\t\t}\n\t\tf(res,nums,pos+1,temp);\n\t\ttemp.push_back(nums[pos]);\n\t\tf(res,nums,pos+1,temp);\n        temp.pop_back();\n\t}\n    vector<vector<int>> subsetsWithDup(vector<int>& nums) {\n        int n=nums.size();\n        set<vector<int>>res;\n        vector<int>temp;\n        f(res,nums,0,temp);\n        vector<vector<int>>ans;\n        for(auto it : res){\n            ans.push_back(it);\n        }\n        return ans;\n    }\n};\n```
['Recursion', 'C++']