[Leetcode] Combinations
来源:互联网 发布:s71200编程手册 编辑:程序博客网 时间:2024/05/01 18:35
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> buf(k); build(n, k, 1, 0, res, buf); return res; } void build(int n, int k, int cur, int idx, vector<vector<int> >& res, vector<int>& buf) { if (idx == k) { res.push_back(buf); return; } for (int i = cur; i <= n; ++i) { buf[idx] = i; build(n, k, i + 1, idx + 1, res, buf); } }};
- 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
- 为Android扩展一个硬件模块
- android编程省电篇--网络更新方式
- android4.0.1 webkit 子资源下载过程分析
- hdu 1008 Elevator
- ubuntu下的eclipse中android sdk manager无法打开问题
- [Leetcode] Combinations
- smarty 教程
- 简单的英语四级作文可能用到的句子
- 你的网站会投放这样的广告么?
- 还原GetModuleFileNameExW
- 使用Lucene开发自己的搜索引擎–(3)indexer索引程序中基本类介绍
- android4.0.1 webkit dom tree 创建过程分析
- C#运算符重载
- 读写ini文件