更新 059.螺旋矩阵II 排版格式修复

This commit is contained in:
jinbudaily
2023-07-17 15:47:48 +08:00
parent 76c84efca0
commit 7a30d500cb

View File

@ -26,7 +26,7 @@
## 算法公开课 ## 算法公开课
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html)[拿下螺旋矩阵LeetCode59.螺旋矩阵II](https://www.bilibili.com/video/BV1SL4y1N7mV),相信结合视频再看本篇题解,更有助于大家对本题的理解**。 **[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html)[拿下螺旋矩阵LeetCode59.螺旋矩阵II](https://www.bilibili.com/video/BV1SL4y1N7mV),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
## 思路 ## 思路
这道题目可以说在面试中出现频率较高的题目,**本题并不涉及到什么算法,就是模拟过程,但却十分考察对代码的掌控能力。** 这道题目可以说在面试中出现频率较高的题目,**本题并不涉及到什么算法,就是模拟过程,但却十分考察对代码的掌控能力。**
@ -125,15 +125,15 @@ public:
## 类似题目 ## 类似题目
* 54.螺旋矩阵 * [54.螺旋矩阵](https://leetcode.cn/problems/spiral-matrix/)
* 剑指Offer 29.顺时针打印矩阵 * [剑指Offer 29.顺时针打印矩阵](https://leetcode.cn/problems/shun-shi-zhen-da-yin-ju-zhen-lcof/)
## 其他语言版本 ## 其他语言版本
Java ### Java
```Java ```Java
class Solution { class Solution {
@ -176,7 +176,7 @@ class Solution {
} }
``` ```
python3: ### python3:
```python ```python
class Solution: class Solution:
@ -207,7 +207,7 @@ class Solution:
return nums return nums
``` ```
javaScript ### JavaScript:
```javascript ```javascript
@ -259,7 +259,7 @@ var generateMatrix = function(n) {
``` ```
TypeScript: ### TypeScript:
```typescript ```typescript
function generateMatrix(n: number): number[][] { function generateMatrix(n: number): number[][] {
@ -304,7 +304,7 @@ function generateMatrix(n: number): number[][] {
}; };
``` ```
Go: ### Go:
```go ```go
package main package main
@ -397,7 +397,7 @@ func generateMatrix(n int) [][]int {
} }
``` ```
Swift: ### Swift:
```swift ```swift
func generateMatrix(_ n: Int) -> [[Int]] { func generateMatrix(_ n: Int) -> [[Int]] {
@ -453,7 +453,7 @@ func generateMatrix(_ n: Int) -> [[Int]] {
} }
``` ```
Rust: ### Rust:
```rust ```rust
impl Solution { impl Solution {
@ -506,7 +506,8 @@ impl Solution {
} }
``` ```
PHP: ### PHP:
```php ```php
class Solution { class Solution {
/** /**
@ -548,7 +549,8 @@ class Solution {
} }
``` ```
C: ### C:
```c ```c
int** generateMatrix(int n, int* returnSize, int** returnColumnSizes){ int** generateMatrix(int n, int* returnSize, int** returnColumnSizes){
//初始化返回的结果数组的大小 //初始化返回的结果数组的大小
@ -607,7 +609,8 @@ int** generateMatrix(int n, int* returnSize, int** returnColumnSizes){
return ans; return ans;
} }
``` ```
Scala: ### Scala:
```scala ```scala
object Solution { object Solution {
def generateMatrix(n: Int): Array[Array[Int]] = { def generateMatrix(n: Int): Array[Array[Int]] = {
@ -659,7 +662,8 @@ object Solution {
} }
} }
``` ```
C# ### C#
```csharp ```csharp
public class Solution { public class Solution {
public int[][] GenerateMatrix(int n) { public int[][] GenerateMatrix(int n) {
@ -688,3 +692,4 @@ public class Solution {
<a href="https://programmercarl.com/other/kstar.html" target="_blank"> <a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/> <img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a> </a>