Next Permutation
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 is the next lexicographically greater permutation. If such arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order).
Next Permutation

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 is the next lexicographically greater permutation. If such arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order).

Example 1:
Input: [1,2,3]
Output: [1,3,2]
Input
arr =[1,2,3]
Initializing

Find the next lexicographically greater permutation of [1, 2, 3]

Array
1
0
2
1
3
2
i (pivot)
j (swap target)
Suffix
Variables
No variables to display
DepthFunction Call
Stack empty
0/7