Powerset Time : O(n * 2^n) Space : O(n * 2^n) 1234567891011121314151617#include <vector>using namespace std;vector<vector<int>> powerset(vector<int> array) { vector<vector<int>> res; res.emplace_back(); for(auto& a : array) { int sz = res.size(); for(int i = 0; i < sz; i++) { auto set = res[i]; set.push_back(a); res.push_back(set); } } return res;}