We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33568af commit e1a6ec1Copy full SHA for e1a6ec1
Arrays/Spiral_Matrix.py
@@ -1,3 +1,16 @@
1
+'''
2
+ Given a 2D array, print it in spiral form. See the following examples.
3
+
4
+Input:
5
+ 1 2 3 4
6
+ 5 6 7 8
7
+ 9 10 11 12
8
+ 13 14 15 16
9
+Output:
10
+1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
11
12
13
14
# Complexity Analysis
15
16
# Time Complexity: O(N)O(N), where NN is the total number of elements in the input matrix. We add every element in the matrix to our final answer.
0 commit comments