[Leetcode] Combinations
来源:互联网 发布:北京人在纽约 知乎 编辑:程序博客网 时间:2024/05/01 08:38
class Solution {public: vector<vector<int> > combine(int n, int k) { // Start typing your C/C++ solution below // DO NOT write int main() function vector<vector<int> > res; vector<int> cache; comb(n, k, 0, 1, cache, res); return res; } void comb(int n, int k, int curCount, int curIdx, vector<int> cache, vector<vector<int> >& res) { if (curCount == k) { res.push_back(cache); return; } if (curIdx > n) return; cache.push_back(curIdx); comb(n, k, curCount + 1, curIdx + 1, cache, res); cache.pop_back(); comb(n, k, curCount, curIdx + 1, cache, res); }};
- LeetCode: Combinations
- LeetCode: Combinations
- LeetCode Combinations
- [Leetcode] Combinations
- [LeetCode] Combinations
- Leetcode: Combinations
- LeetCode Combinations
- [Leetcode] Combinations
- [Leetcode] Combinations
- [leetcode] Combinations
- [LeetCode]Combinations
- [leetcode]Combinations
- LeetCode-Combinations
- [leetcode] Combinations
- LeetCode - Combinations
- 【Leetcode】Combinations
- Leetcode: Combinations
- 【leetcode】Combinations
- freemarker 转义字符
- Introduction to Algorithm( chapter 9 and 10)
- 项目管理之名词
- asp.net(c#)存储过程调用实例
- 14-1
- [Leetcode] Combinations
- 个人C++调试问题汇总
- container_of 详解
- yum的使用全解
- x86/x86_64 CPU控制寄存器(Control Registers)
- android和linux开源社区的分裂
- .C#中的委托是什么?事件是不是一种委托?
- char *、CString和string之间的类型转换 .
- hdu+1595+删边最长最短路