You are given an integer array nums of length n, representing a permutation of integers from n
In one operation, you can perform either of the following actions:
Shift the array cyclically to the left by n
Reverse the entire array.
Return the minimum number of operations required to sort nums in ascending order. If it is impossible to sort the array, return
Constraints:
n nums.length
nums[i] n
nums is a permutation of integers from n
You are given an integer array nums of length n, representing a permutation of integers from n
In one operation, you can perform either of the following actions:
Shift the array cyclically to the left by n
Reverse the entire array.
Return the minimum number of operations required to sort nums in ascending order. If it is impossible to sort the array, return
Constraints:
n nums.length
nums[i] n
nums is a permutation of integers from n