简单回朔题
class Solution {public: //start=0; void func(int start,int k,int n,vector<int>& temp,vector<vector<int>>& result) { if(temp.size()==k) result.push_back(temp); else { for(int i=start+1;i<=n;i++) { temp.push_back(i); func(i,k,n,temp,result); temp.pop_back(); } } return; } vector<vector<int>> combine(int n, int k) { int start=0; vector<int> temp; vector<vector<int>> result; func(start,k,n,temp,result); return result; }};新闻热点
疑难解答