分析
class Solution {
public:
vector<vector<int>> ans;
vector<int>path;
void dfs(int u,vector<int>& nums){
ans.push_back(path);
for(int i=u;i<nums.size();i++){
path.push_back(nums[i]);
dfs(i+1,nums);
path.pop_back();
}
return ;
}
vector<vector<int>> subsets(vector<int>& nums) {
dfs(0,nums);
return ans;
}
};