Daily challenge for 2025-11-14
318. Next Permutation
A permutation of an array of integers is an arrangement of its members into a sequence or linear order.
Implement a function to rearrange the numbers into the lexicographically next greater permutation. If no such arrangement exists, rearrange to the lowest possible order (sorted in ascending order).
The replacement must be in-place and return the modified array.
Example:Input: nums = [1,2,3]Output: [1,3,2]
Example 2:Input: nums = [3,2,1]Output: [1,2,3]
Run this challenge interactively in Python or JavaScript when the app loads.