mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
更新 059.螺旋矩阵II 排版格式修复
This commit is contained in:
@ -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>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user