100%BEATS || C++
Code\n\nclass Solution {\npublic:\n    void solve(int i,int &n,vector<int> &v,vector<int> &tmp,vector<vector<int>> &ans){\n        if(i>=n){\n            ans.pu
# Code\n```\nclass Solution {\npublic:\n    void solve(int i,int &n,vector<int> &v,vector<int> &tmp,vector<vector<int>> &ans){\n        if(i>=n){\n            ans.push_back(tmp);\n            return;\n        }\n        tmp.push_back(v[i]);\n        solve(i+1,n,v,tmp,ans); \n        tmp.pop_back();\n        while(i+1<n&&v[i+1]==v[i])i++;\n        solve(i+1,n,v,tmp,ans);\n    }\n    vector<vector<int>> subsetsWithDup(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        vector<vector<int>> ans;\n        vector<int> tmp;\n        int n = nums.size();\n        solve(0,n,nums,tmp,ans);\n        // sort(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```
['Array', 'Backtracking', 'Bit Manipulation', 'C++']