Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- void fun (vector <vector <int>> &res , vector <int> &path, vector <int> &nums, int idx)
- {
- res.push_back (path);
- for (int i = idx ; i < nums.size(); i++)
- {
- path.push_back(nums[i]);
- fun (res , path , nums , i + 1);
- path.pop_back();
- }
- }
- vector<vector<int>> subsets(vector<int>& nums) {
- vector < vector <int> > res ;
- vector <int> path;
- fun (res , path, nums , 0);
- return res;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement