Problem · Array
Next Permutation
Learn this problemProblem statement
Return the lexicographically next permutation of nums. If the current ordering is the greatest possible, return the smallest ordering. Duplicate values are allowed.
Function
nextPermutation(nums: int[]) → int[]Examples
Example 1
nums = [1,2,3]return = [1,3,2]Swapping the final two values gives the next greater ordering.
Constraints
1 <= nums.length <= 10000- Values fit in a signed 32-bit integer.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024