Problem statement- Given an array Arr[] of integers, rearrange the numbers of the given array into the lexicographically next greater permutation of numbers.
Input format: Arr[] = {1,3,2}
Output: Arr[] = {2,1,3}
Explanation: All permutations of {1,2,3} are {{1,2,3} , {1,3,2}, {2,13} , {2,3,1} , {3,1,2} , {3,2,1}}. So, the next permutation just after {1,3,2} is {2,1,3}.
Problem statement- Given an array Arr[] of integers, rearrange the numbers of the given array into the lexicographically next greater permutation of numbers. Input format: Arr[] = {1,3,2} Output: Arr[] = {2,1,3}
Explanation: All permutations of {1,2,3} are {{1,2,3} , {1,3,2}, {2,13} , {2,3,1} , {3,1,2} , {3,2,1}}. So, the next permutation just after {1,3,2} is {2,1,3}.