


Choose an integer ‘K’ where 1 <= ‘K’ <= ARR.LENGTH.
Reverse the sub-array ARR[0, , ,K-1] (0-indexed).
1. The array given will have elements between 1 to ‘N’, where N is the size of the array, and all elements of the array will be unique.
2. Any valid answer that sorts the array within 10 * array’s length flips will be judged as correct.
3. If the array is already sorted return an empty list.
If ARR = [3,2,1] and we performed a pancake flip choosing K = 3, we reverse the sub-array [3,2,1], so ARR = [1,2,3] . Hence the array becomes sorted therefore return {3}.
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains a single integer N, where ‘N’ is the number of elements of the array.
The second line of each test case contains ‘N’ space-separated integers, denoting the array elements.
For each test case, return the sequence of flips made.
The output of each test case will be printed in a separate line.
You don’t need to print anything. You just need to implement the given function.
1 <= T <= 5
1 <= N <= 100
1 <= ARR[i] < N
Time Limit: 1 second
The main idea to solve this problem is that if we want to place a number at an index, then we need a maximum of 2 moves that are:-