Counter Spiral in PYTHON | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Counter Spiral in PYTHON

Given a square matrix, you have to write a program to print it in a counter-clockwise spiral form. Input Format: The first line of the input contains a number n which represents the number of rows and columns in the matrix. From the second line contains the n rows with each row having n elements separated by a space. Output Format: Print the elements in a single line with each element separated by a space Example: Input: 4 25 1 29 7 24 20 4 32 16 38 29 1 48 25 21 19 Out 25 24 16 48 25 21 19 1 32 7 29 1 20 38 29 4

18th Sep 2018, 6:08 PM
Krishnanshu Dey
Krishnanshu Dey - avatar
2 Answers
0
tnx u
23rd Sep 2018, 5:52 PM
Krishnanshu Dey
Krishnanshu Dey - avatar
- 2
This might help, though this won't work if you repeat the numbers as you did in the example. https://code.sololearn.com/cEO9gFYIii7H/#
23rd Sep 2018, 2:44 PM
Harmeet Singh Bhatia
Harmeet Singh Bhatia - avatar