LeetCode || Permutations
来源:互联网 发布:当当网的价值网络 编辑:程序博客网 时间:2024/06/09 21:27
class Solution {public: void permutation(vector<int>& nums, int start, vector<vector<int>>& permu) { if(start == nums.size()) { permu.push_back(nums); } for(int i = start;i<nums.size();i++) { //交换i和start,相当于固定start位置的值 int tmp = nums[i]; nums[i] = nums[start]; nums[start] = tmp; permutation(nums, start+1, permu); //还原之前的交换 tmp = nums[i]; nums[i] = nums[start]; nums[start] = tmp; } } vector<vector<int>> permute(vector<int>& nums) { vector<vector<int>> permu; permutation(nums, 0, permu); return permu; }};
0 0
- 【LeetCode】Permutations && Permutations II
- leetcode: Permutations/Permutations II
- leetcode Permutations & Permutations II
- [Leetcode]Permutations && Permutations II
- LeetCode: Permutations
- LeetCode: Permutations
- [Leetcode] Permutations
- [LeetCode] Permutations
- Leetcode: Permutations
- [Leetcode] Permutations
- [Leetcode] Permutations
- [LeetCode]Permutations
- LeetCode-Permutations
- [leetcode] permutations
- LeetCode - Permutations
- Leetcode: Permutations
- 【leetcode】Permutations
- 【LeetCode】Permutations
- ubuntu 12.04 tomcat + jsp的入门
- Meteor全栈开发平台 - 不仅仅是前端
- c# xml序列化和反序列化
- resin的部署安装
- 在Debian 8纯命令行安装android开发环境方法
- LeetCode || Permutations
- Light oj 1025 (区间dp)
- 解决:Jersey搭建webService报错:com.sun.jersey.spi.inject.Errors$ErrorMessagesException
- Ps中 不透明度和填充的区别
- Scala总结
- Effective C++——条款29(第5章)
- 在eclipse中如何查找指定文文件
- ListView使用过程记录
- MapReduce程序初步入门