leetcode_medium_array
problem
solution #1:
According to Wikipedia, a man named Narayana Pandita presented the following simple algorithm to solve this problem in the 14th century. Find the largest index k such that nums[k] < nums[k + 1]. If no such index exists, just reverse nums and done. Find the largest index l > k such that nums[k] < nums[l]. Swap nums[k] and nums[l]. Reverse the sub-array nums[k + 1:].
code
参考
1. leetcode_31. Next Permutation;
完