```
class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
sort(nums.begin(),nums.end());
int max=1<<nums.size(),n=nums.size()-1;
vector<vector<int>> result;
for(int i=0;i<max;i++)
{
int mask=1;
vector<int> vec;
for(int j=nums.size()-1;j>=0;j--)
{
if(i&(mask<<j)) vec.push_back(nums[n-j]);
}
result.push_back(vec);
}
return result;
}
};
```