+ 1
How to print a given matrix in spiral form in Python
input: A = [[2, 4, 6, 8], [5, 9, 12, 16], [2, 11, 5, 9], [3, 2, 1, 8]] out put: 2 4 6 8 16 9 8 1 2 3 2 5 9 12 5 11
4 odpowiedzi
+ 3
The logic of iterating 2d array in spiral, but not used to display array-content, only displaying each state of spiral iterating (could be easily modified to output an array content ;)
https://code.sololearn.com/cZkLiwlXZ6iQ/?ref=app
+ 2
Hey
this is my code
https://code.sololearn.com/c3702c4VD946/?ref=app
+ 2
Thank you all Finally I got it,
Here it is my code: https://code.sololearn.com/c2hs39NrqHX5/#py
0
check the logic...
slight different code..
but logic is same...
input a integer size of matrix like
5
https://code.sololearn.com/cNCzt3qU6XTs/?ref=app