Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/leet/ challenge #1: permutation sequence

Name: Anonymous 2021-03-21 19:34

Implement
next permutation
, which rearranges numbers (nums) 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:
Input:[1,2,3]
Output: [1,3,2]

Example 2:
Input: [3,2,1]
Output: [1,2,3]

Example 3:
Input: [1,1,5]
Output: [1,5,1]

Example 4:
Input: [1]
Output: [1]

Constraints:
1 <= nums.length <= 10e6
0 <= nums[i] <= 2147483647



Shortest code wins bonus prize, but the main prize goes to every post with actually functioning code.

The deadline is 691200 seconds from this post's timestamp.

Name: Anonymous 2021-03-23 7:48

>>15
1.it was too simple and boring code golfin'.
2.some people dislike BBCode posting or find it annoying(spoilers, stacking multiple lines with super/sub text)
3.People don't play this BBCode golf unless they have severe autism.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List