vector<vector<int>> subset;
void gen(vector<int>& nums,int i,vector<int> sub)
{
if(i==nums.size())
{
subset.push_back(sub);
return;
}
gen(nums,i+1,sub);
sub.push_back(nums[i]);
gen(nums,i+1,sub);
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter