2018年3月5日

59.Spiral Matrix II

摘要: 题目链接:https://leetcode.com/problems/spiral-matrix-ii/description/ 题目大意:构造蛇形矩阵。 法一:模板模拟。代码如下(耗时2ms): 1 public int[][] generateMatrix(int n) { 2 int[][] 阅读全文

posted @ 2018-03-05 11:31 二十年后20 阅读(114) 评论(0) 推荐(0) 编辑

54.Spiral Matrix

摘要: 题目链接:https://leetcode.com/problems/spiral-matrix/description/ 题目大意:给一个数组,蛇形存入list后返回。 法一:模板模拟,注意的是这里给的数组,不一定是n*n的,所以要根据行和列分别计算。代码如下(耗时3ms): 1 public L 阅读全文

posted @ 2018-03-05 10:18 二十年后20 阅读(142) 评论(0) 推荐(0) 编辑

导航