0031. Next Permutation
https://leetcode.com/problems/next-permutation
Description
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such an arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order).
The replacement must be in place and use only constant extra memory.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= nums.length <= 100
0 <= nums[i] <= 100
ac
Last updated