
The given queue will always be of even length.
If N= 10
and Q = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
then the output will be
Q = [10, 60, 20, 70, 30, 80, 40, 90, 50, 100]
The first line contains an integer 'T' which denotes the number of test cases or queries to be run. Then the test cases are as follows.
The first line of each test case contains an integer 'N' which denotes the size of the queue.
The second line of each test case contains elements of the queue. The line consists of values of elements of the queue separated by a single space.
For each test case, print the elements of the queue after interleaving the elements of the first half with the second half.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10^2
2 <= N <= 10^3
0 <= data <= 10^4
Where ‘T’ is the number of test cases, “data” is the value of the element of the queue.
The basic idea is to use a stack to interleave the elements of the queue.