# LeetCode77——Combinations

1.组合中有k个数字

2.组合是递增

3.组合中的数字是{1,2,3,....n} 的子集

class Solution {
private:
void help(int i,int n, int k,vector<int>temp,vector<vector<int>>&result)
{
if (temp.size() == k)//k个数
{
result.push_back(temp);
return;
}
if (temp.size() > 1 && temp.back() < *(temp.end()-2))//递增
return;
for (int index = i+1; index < n+1; index++)//i
{
temp.push_back(index);
help(index , n, k, temp, result);//递归
temp.pop_back();//一次完成要弹出
}
}
public:
vector<vector<int>> combine(int n, int k) {
vector<int> temp;
vector<vector<int>>result;
help(0, n, k, temp, result);

return result;
}
};

#### LeetCode 77. Combinations 解题报告

2016-02-18 14:03:18

#### leetcode 77. Combinations-排列|递归|非递归|Java|Python

2016-06-02 10:43:01

#### LeetCode（77） Combinations

2015-09-17 20:30:07

#### LeetCode-77 Combinations(组合)

2015-05-02 12:06:29

#### [LeetCode]77.Combinations

2015-02-06 16:44:59

#### 个人记录-LeetCode 77. Combinations

2017-01-09 20:40:43

#### leetCode 77.Combinations (组合)

2015-07-22 13:15:00

#### LeetCode 77 Combinations (Python详解及实现)

2017-08-08 13:50:46

#### 【LEETCODE】77-Combinations [Python]

2016-01-07 16:57:28

#### 77 Combinations

2015-10-25 16:20:02