Company: Amazon_29march
Difficulty: medium
Amazon eng[unclear]ers are testing a new tool, the Permutation Sorter, built to reorder sequences using limited operations. Given a permutation of intege[unclear] the objective is to sort the permutation using on[unclear] specific operations: Reverse [unclear]ntire permutation. Transfer the first element of the permutation to [unclear] position, i.e., change arr[0], arr[1], ..., arr[n-1] to [unclear] arr[2], ..., arr[n-1], arr[0] . Formally, given a permutation arr of size n , determine the minimum number of operations needed to sort the given permutation in increasing order. The permutation provid[unclear]s guaranteed to be sorted using only these two [unclear]ons. Note: A permutation of length n is a sequence of integers fro[unclear] containing each number exactly once. Example n = 10 arr = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1] The permutation can be sorted by performi[unclear]ollowing operations: Reverse the permutat[unclear]o get arr = [1, 10, 9, 8, 7, 6, 5, 4, 3, 2] Transfer the first e