Skip to content

Commit c131d5e

Browse files
committed
updated
1 parent 916de29 commit c131d5e

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

dsa-solutions/lc-solutions/0000-0099/0054-spiral-matrix.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: spiral-matrix
33
title: Spiral Matrix
4-
sidebar_label: 0054 Spiral Matrix
4+
sidebar_label: 0054-Spiral-Matrix
55
tags:
66
- Array
77
- Matrix
@@ -69,9 +69,7 @@ We continue this process while adjusting the boundaries until all elements have
6969

7070
### Code in Different Languages
7171

72-
<Tabs>
73-
<TabItem value="cpp" label="C++">
74-
<SolutionAuthor name="@Vipullakum007"/>
72+
### C++ Solution
7573

7674
```cpp
7775

@@ -133,8 +131,8 @@ int main() {
133131
}
134132
</TabItem>
135133
```
136-
### JAVA
137-
```<TabItem value="java" label="Java"> <SolutionAuthor name="@Vipullakum007"/>
134+
### JAVA Solution
135+
```java
138136
import java.util.ArrayList;
139137
import java.util.List;
140138
@@ -185,11 +183,11 @@ public class SpiralMatrix {
185183
System.out.println(sm.spiralOrder(matrix)); // Output: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]
186184
}
187185
}
188-
</TabItem>
186+
189187
```
190-
### Python
188+
### Python Solution
191189

192-
```<TabItem value="python" label="Python"><SolutionAuthor name="@Vipullakum007"/>
190+
```python
193191
def spiralOrder(matrix):
194192
if not matrix:
195193
return []
@@ -230,20 +228,15 @@ matrix = [
230228
]
231229
print(spiralOrder(matrix)) # Output: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]
232230

233-
</TabItem>
234231
```
235-
</Tabs>
236232

237233
### Complexity Analysis
238234
#### Time Complexity: O(m * n)
239-
**Reason:** We visit every element in the matrix exactly once.
235+
>Reason: We visit every element in the matrix exactly once.
240236
241237
**Space Complexity:** O(1)
242-
**Reason:** We only use a fixed amount of extra space, regardless of the input size.
238+
>Reason: We only use a fixed amount of extra space, regardless of the input size.
243239
### References
244240
**LeetCode Problem:** Spiral Matrix
245241

246-
**Author's LeetCode Profile:** Vipul Lakum
247-
```
248-
249242

0 commit comments

Comments
 (0)