Skip to main content
Next Permutation | AlgoCracked
AlgoCracked
ProblemsNext Permutation
Medium39.0% acceptance
ArrayTwo Pointers

Next Permutation

Rearrange the numbers of nums into the next greater permutation in lexicographic order, in place . If no greater permutation exists (the array is in descending order), rearrange it into the smallest permutation — that is, sorted ascending. Input format The input is a single argument [nums] , a JSON integer array, e.g. [[1,2,3]] . The graded answer is the array after your method mutates it; any value your method returns is ignored.

Loading workspace…