C++ Solution || Easiest Approach
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\nvoid solve(vector<vector<int>>&ans,vector<int>&output,int index,vector<int>& nums)\n    {\n        //base case\n        if(index>=nums.size())\n        {\n            ans.push_back(output);\n            return;\n        }\n\n        //exclude\n         solve(ans,output,index+1,nums);\n\n        //include\n        output.push_back(nums[index]);\n        solve(ans,output,index+1,nums);\n        output.pop_back();\n    } \n    vector<vector<int>> subsetsWithDup(vector<int>& nums) {\n       sort(nums.begin(),nums.end());\n        vector<vector<int>>ans;\n        vector<int>output;\n        int index=0;\n        solve(ans,output,index,nums);\n        set<vector<int>>st;\n        for(int i=0;i<ans.size();i++)\n        {\n            st.insert(ans[i]);\n        }\n        vector<vector<int>>ans2;\n        for(auto s:st)\n        {\n            ans2.push_back(s);\n        }\n        return ans2; \n    }\n};\n```
['Backtracking', 'Ordered Set', 'C++']