



The first line contains an integer 'T' which denotes the number of test cases or queries to be run. Then the test cases follow.
The first line of each test case contains two single space separated integers N and M, denoting the number of rows and columns respectively.
The next 'N' lines, each contains 'M' single space-separated integers representing the elements in a row of the matrix.
For each test case/query, print the spiral path of the given matrix.
Output for every test case will be printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 10^2
1 <= M <= 10^2
-10^9 <= mat[i][j] <= 10^9
Time Limit: 1second
Divide the matrix into loops. Print all the elements in the clockwise order from the first-outer layer, followed by the elements from the second outer layer, and so on. Use four loops to print all the elements. Every ‘for’ loop defines a single direction movement along with the matrix. The first loop represents the movement from left to right, the second loop represents the movement from top to bottom, the third represents the movement from the right to left, and the fourth represents the movement from bottom to up.
Decrease the dimensions of the matrix in each recursive call. The idea of printing the loops is the same as in the previous approach. In simple words make the matrix smaller from both ends and in each recursive call print the outer elements in a spiral fashion.
Split Array Into K Subarrays
Bob’s Robot
Transpose of a Matrix
Number of Digits
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series