#include <vector> class Solution { public: void dfs(vector<vector<int>> & ans, vector<int> &temp, vector<int> S, int n, int start){ ans.push_back(temp); for(int i = start; i < n; i++){ temp.push_back(S[i]); dfs(ans, temp, S, n, i + 1); temp.pop_back(); } } vector<vector<int> > subsets(vector<int>& S) { // write code here vector<int> temp; vector<vector<int>> ans; int n = S.size(); dfs(ans, temp, S, n, 0); return ans; } };