Untitled
class Solution { public: void solve(int k,int start,vector<int>&comb,vector<vector<int>>&res,int n){ if(comb.size()==k) { res.push_back(comb); return; } for(int i=start;i<=n;i++){ comb.push_back(i); solve(k,i+1,comb,res,n); comb.pop_back(); } } vector<vector<int>> combine(int n, int k) { vector<vector<int>> res; vector<int> comb; solve(k,1,comb,res,n); return res; } };