← ALL NOTES
Array

31. Next Permutation

The next permutation is the smallest possible increase over the current one, and that pins down a precise three-step recipe. Scan from the right for the first ascent — the rightmost i with nums[i] <…

Loading…