LeetCode Combinations
来源:互联网 发布:windows源无效 编辑:程序博客网 时间:2024/05/01 16:43
class Solution {public: vector<vector<int> > combine(int n, int k) { // Start typing your C/C++ solution below // DO NOT write int main() function ans.clear(); vector<int> cur; recursion(n, k, cur, 1); return ans; }private: vector<vector<int> > ans; void recursion(int n, int k, vector<int> cur, int num) { if (k == 0){ ans.push_back(cur); } else if (num <= n) { cur.push_back(num); recursion(n, k - 1, cur, num + 1); cur.pop_back(); recursion(n, k, cur, num + 1); } }};
- 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
- 千山独行-一个人的创业路(连载十一)
- EL和JSTL
- node.js chat程序如何实现Ajax long-polling长链接刷新模式
- 你中枪了吗
- BIT1054Largest prime factor
- LeetCode Combinations
- Consistent Hashing 一致性hash算法
- fsync()和fdatasync()函数
- HDU 1232 畅通工程 最小强连通通路-并查集
- 经典开源项目介绍(游戏、游戏引擎、通用组件)
- ERLANG OTP源码分析
- HTML元素用法
- Linux下查看并发连接数和连接状态
- asp.net 压缩 System.IO.Packaging.Package