Skip to content

Commit e1a6ec1

Browse files
author
Sitesh Pattanaik
committed
Added problem statement
1 parent 33568af commit e1a6ec1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Arrays/Spiral_Matrix.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
114
# Complexity Analysis
215

316
# 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

Comments
 (0)