Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 647 Bytes

File metadata and controls

16 lines (13 loc) · 647 Bytes

Problem 19: Order Inversion Peak (Next Permutation)

Problem Statement

A permutation of an array of integers is an arrangement of its members into a sequence or linear order. The next permutation of an array of integers is the next lexicographically greater permutation of its integer. If such arrangement is not possible, it must be rearranged as the lowest possible order (i.e., sorted in ascending order). The replacement must be in place and use only constant extra memory.

Input Format

  • An array of integers nums.

Example

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