BETA
Spirally traversing a matrix
Submissions: 14664   Accuracy:

33.78%

  Difficulty: Easy

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

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 **

Author: atharv


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