

For corner elements, we need to consider only one neighbour for comparison.
For the given array : 10 5 20 30 40 35 50

The red circle at index 1,5 are local minima because elements at index 1, and 5 both are smaller to its neighbours.
The green circle at index 0,4,6 are local maxima, because element at index 4 is greater than its neighbours, and element at 0, and 4 are corner elements and also greater than its one neighbour.
The first line of input contains an integer 'T' representing the number of test cases or queries to be processed.
Then the test case follows.
The first line of each test case contains integer N denoting the size of the array.
The second line of each test case contains 'N' single space-separated integers representing the array elements.
For each test case
In the first line, print all the space-separated indices of local minima in the given array
In the second line, print all the space-separated indices of local maxima in the given array.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
2 <= N <= 10^5
-10^9 <= arr[i] <= 10^9
Time Limit: 1 sec
The idea is to iterate through the given array and at each index i, we check its neighbors to check if it's local minima or maxima.