模拟法---螺旋矩阵
模拟法
59螺旋矩阵Ⅱ
class Solution {
public int[][] generateMatrix(int n) {
int l = 0, r = n - 1, t = 0, b = n - 1;
int[][] mat = new int[n][n];
int num = 1, tar = n * n;
while(num <= tar){
for(int i = l; i <=
原创
2022-05-10 20:47:19 ·
63 阅读 ·
0 评论