KhushbooGoel01 / Top-Interview-Questions--Leetcode

These are codes for Top Interview Questions from Leetcode.
242 stars 141 forks source link

Next Permutation #268

Closed ARYASINGHBJC closed 1 year ago

ARYASINGHBJC commented 1 year ago

Problem: If all the permutations of the array are sorted in one container according to their lexicographical order, then the next permutation of that array is the permutation that follows it in the sorted container. If such arrangement is not possible, the array must be rearranged as the lowest possible order (i.e., sorted in ascending order).

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