```
class Solution {
public:
void f(vector<int>& temp,vector<vector<int>>&result,int i,vector<int>& nums){
if(i==nums.size()){
result.push_back(temp);
return;
}
temp.push_back(nums[i]);
f(temp,result,i+1,nums);
temp.pop_back();
f(temp,result,i+1,nums);
return;
}
vector<vector<int>> subsets(vector<int>& nums) {
sort(nums.begin(),nums.end());
vector<int> temp;
vector<vector<int>>result;
f(temp,result,0,nums);
return result;
}
};
```