void ssHelp(vector<vector<int>> &res,vector<int> &nums,vector<int> &rp,unsigned int cur) { res.push_back(rp); for(unsigned int i=cur;i<nums.size();++i) { rp.push_back(nums[i]); ssHelp(res,nums,rp,i+1); rp.pop_back(); } } vector<vector<int>> subsets(vector<int>& nums) { vector<vector<int>> res; vector<int> rp; ssHelp(res,nums,rp,0); return res; }
[LeetCode] 78. Subsets
最新推荐文章于 2022-10-22 22:28:31 发布