Skip to content

Commit 916de29

Browse files
committed
updated
1 parent 7ed3aa0 commit 916de29

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ int main() {
132132
return 0;
133133
}
134134
</TabItem>
135-
<TabItem value="java" label="Java">
136-
<SolutionAuthor name="@Vipullakum007"/>
137-
import java.util.ArrayList;
135+
```
136+
### JAVA
137+
```<TabItem value="java" label="Java"> <SolutionAuthor name="@Vipullakum007"/>
138+
import java.util.ArrayList;
138139
import java.util.List;
139140
140141
public class SpiralMatrix {
@@ -185,8 +186,10 @@ public class SpiralMatrix {
185186
}
186187
}
187188
</TabItem>
188-
<TabItem value="python" label="Python">
189-
<SolutionAuthor name="@Vipullakum007"/>
189+
```
190+
### Python
191+
192+
```<TabItem value="python" label="Python"><SolutionAuthor name="@Vipullakum007"/>
190193
def spiralOrder(matrix):
191194
if not matrix:
192195
return []
@@ -228,15 +231,19 @@ matrix = [
228231
print(spiralOrder(matrix)) # Output: [1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]
229232
230233
</TabItem>
234+
```
231235
</Tabs>
232-
Complexity Analysis
233-
Time Complexity: O(m * n)
234-
Reason: We visit every element in the matrix exactly once.
235236

236-
Space Complexity: O(1)
237-
Reason: We only use a fixed amount of extra space, regardless of the input size.
238-
References
239-
LeetCode Problem: Spiral Matrix
237+
### Complexity Analysis
238+
#### Time Complexity: O(m * n)
239+
**Reason:** We visit every element in the matrix exactly once.
240+
241+
**Space Complexity:** O(1)
242+
**Reason:** We only use a fixed amount of extra space, regardless of the input size.
243+
### References
244+
**LeetCode Problem:** Spiral Matrix
240245

241-
Author's LeetCode Profile: Vipul Lakum
246+
**Author's LeetCode Profile:** Vipul Lakum
242247
```
248+
249+

0 commit comments

Comments
 (0)