Problems
00:00

18. Next Permutation

MediumArrayGoogleMicrosoft

Given an integer array nums, return its next lexicographically greater permutation.

Return the adjusted nums array for the current judge. The original LeetCode problem requires an in-place update.

Example 1:

Input: nums = [1,2,3]
Output: [1,3,2]

Example 2:

Input: nums = [3,2,1]
Output: [1,2,3]

Constraints:

  • 1 <= nums.length <= 100
Core code mode
● Auto-savedLine 1, column 1