标签:solution leetcode problem turn int problems subsets code amp
class Solution {
public:
vector<vector<int>> ans;
vector<vector<int>> subsets(vector<int>& nums) {
vector<int> res;
ans.push_back(res);
fun(res,nums,0);
return ans;
}
void fun(vector<int> res,vector<int> nums,int n)
{
for(int i=n;i<nums.size();i++)
{
res.push_back(nums[i]);
ans.push_back(res);
fun(res,nums,i+1);
res.pop_back();
}
}
};
标签:solution leetcode problem turn int problems subsets code amp
原文地址:https://www.cnblogs.com/dacc123/p/11781441.html