LeetCode - 31. Next Permutation
2017-03-05 17:26
375 查看
31. Next Permutation
Problem's Link
----------------------------------------------------------------------------
Mean:
给定一个数列,求这个数列字典序的下一个排列.
analyse:
next_permutation函数的运用.
Time complexity: O(N)
view code
class Solution
{
public:
void nextPermutation(vector<int>& nums)
{
if(next_permutation(nums.begin(),nums.end()))
return;
else
{
sort(nums.begin(),nums.end());
return;
}
}
};
Problem's Link
----------------------------------------------------------------------------Mean:
给定一个数列,求这个数列字典序的下一个排列.
analyse:
next_permutation函数的运用.
Time complexity: O(N)
view code
class Solution
{
public:
void nextPermutation(vector<int>& nums)
{
if(next_permutation(nums.begin(),nums.end()))
return;
else
{
sort(nums.begin(),nums.end());
return;
}
}
};
相关文章推荐
- [LeetCode]31.nextPermutation
- [LeetCode]31. Next Permutation
- leetcode 刷题之路 31 Triangle
- LeetCode 31: Next Permutation
- 【leetcode】【31】Next Permutation
- leetcode——31——Next Permutation
- LeetCode-31-Next Permutation(C语言实现)
- leetcode: 31. Next Permutation
- leetcode 31:Next Permutation 原理剖析
- LeetCode---(31) Next Permutation
- LeetCode 31.Next Permutation & 33.Search in Rotated Sorted Array
- leetcode做题总结,题目Next Permutation 31
- leetCode(31):Combination Sum III 分类: leetCode 2015-07-07 10:23 163人阅读 评论(0) 收藏
- LeetCode 31. Next Permutation
- LeetCode 31
- LeetCode --- 31. Next Permutation
- LeetCode 31 Next Permutation (下一排列)
- leetcode 31. Next Permutation
- [LeetCode]--31. Next Permutation
- [LeetCode]31. Next Permutation