C++ Simple and Short Solution - No Recursion
\nclass Solution {\npublic:\n    vector<vector<int>> subsetsWithDup(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        \n        vector<vect
```\nclass Solution {\npublic:\n    vector<vector<int>> subsetsWithDup(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        \n        vector<vector<int>> res = {{}};\n        vector<int> curr;\n        int size;\n        \n        for (auto num : nums) {\n            size = res.size();\n            \n            for (int i = 0; i < size; i++) {\n                curr = res[i];\n                curr.push_back(num);\n                if (find(res.begin(), res.end(), curr) == res.end())\n                    res.push_back(curr);\n            }\n        }\n        \n        return res;\n    }\n};\n```\n**Like it? please upvote!**
['C']