Next Lexicographical Permutation

Given an integer array arr, modify it in place to its next lexicographically greater permutation.

If no such permutation exists because the array is already in descending order, rearrange it in...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: