6.15 二刷hot100 普通数组

This commit is contained in:
zhangsan 2025-06-19 21:56:26 +08:00
parent 46a9f57fb2
commit af0416096f
2 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,5 @@
package matrix;
import java.util.List;
/**
* 题目59. 螺旋矩阵 II (generateMatrix)
@ -13,6 +12,7 @@ import java.util.List;
* 链接https://leetcode.cn/problems/spiral-matrix-ii/
*/
//二刷会做同54题一个思路
public class GenerateMatrix {
public int[][] generateMatrix(int n) {
int[][]res=new int[n][n];

View File

@ -16,6 +16,7 @@ import java.util.List;
输出[1,2,3,4,8,12,11,10,9,5,6,7]
*/
//没想出
//二刷会做
public class SpiralOrder {
public List<Integer> spiralOrder(int[][] matrix) {
List<Integer> result = new ArrayList<>();