标签:back tco ++ int fun pop 题目 code tps
class Solution {
public:
vector<vector<int>> ans;
vector<vector<int>> combine(int n, int k) {
if(k>n)
return ans;
vector<int> res;
fun(0,0,n,k,res);
return ans;
}
void fun(int n1,int k1,int n,int k,vector<int> res)
{
if(k1==k)
{
ans.push_back(res);
return;
}
for(int i=n1+1;i<=n;i++)
{
res.push_back(i);
fun(i,k1+1,n,k,res);
res.pop_back();
}
}
};
标签:back tco ++ int fun pop 题目 code tps
原文地址:https://www.cnblogs.com/dacc123/p/11781444.html