31. Next Permutation
----------------------------------------------------------------------------
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; } } };