BETA

Difficulty Level: Easy

Submissions: 8285 Accuracy:

33.2%

Spirally traversing a matrix

Traverse a 4x4 matrix of integers in spiral form.

Input: The first line of input contains an integer T denoting the number of test cases. First four lines of the test case will contain four elements each.
Output: Spiral array will be displayed in a single line.
Constraints:

1 <=T<= 100

1 <=N<= 100
Example:

Input:
1
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Output: 
1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10 

** For More Input/Output Examples Use 'Expected Output' option **

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.