Given an array of positive integers arr, return the lexicographically largest permutation that is smaller than arr and can be formed by swapping two elements at distinct indices exactly once. If no such permutation exists, return arr unchanged.
Constraints:
arr.length
arr[i]
Given an array of positive integers arr, return the lexicographically largest permutation that is smaller than arr and can be formed by swapping two elements at distinct indices exactly once. If no such permutation exists, return arr unchanged.
Constraints:
arr.length
arr[i]