445. Next Greater Permutation
Given an array of positive integers, find the next lexicographically greater permutation of the array. If such arrangement is not possible, return the array sorted in ascending order. You are given an array A of size N. Find the next greater permutation of array A.
The first line contains an integer N, the size of the array. The second line consists of the array A.
Print the next permutation of array A.
3 2 1 3
2 3 1
1 <= A[i] <= 10^5 1 <= N <= 10^5