class Solution { public: vector> vec_vec_int; vector vec_int; vector > subsets(vector & nums) { int n = nums.size(); backtrack(nums, 0); return vec_vec_int; } void backtrack(vector & nums, int left){ vec_vec_int.push_back(vec_int); for(int i = left; i < nums.size(); i++){ vec_int.push_back(nums[i]); backtrack(nums, i + 1); vec_int.pop_back(); } } };
Accepted
10/10 cases passed (0 ms)
Your runtime beats 100 % of cpp submissions
Your memory usage beats 76.08 % of cpp submissions (6.9 MB)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)