Skip to content

Commit 5809778

Browse files
committed
note
1 parent 1f703f9 commit 5809778

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎src/main/java/com/chen/algorithm/znn/array/offer/test29/Solution.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public int[] spiralOrder1(int[][] matrix) {
6565
int left = 0, right = matrix[0].length - 1, top = 0, bottom = matrix.length - 1;
6666

6767
while (numEle >= 1) {
68-
for (int i = left; i <= right && numEle >= 1; i++) {
68+
for (int i = left; i <= right && numEle >= 1; i++) { //注意边界 >=,<=
6969
result[idx++] = matrix[top][i];
7070
numEle--;
7171
}
72-
top++;
72+
top++; //注意边界 >=,<=,因为这里都做了递增和递减处理,所以遍历需要带等号
7373
for (int i = top; i <= bottom && numEle >= 1; i++) {
7474
result[idx++] = matrix[i][right];
7575
numEle--;

‎src/main/java/com/chen/algorithm/znn/note‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ sort
6363
快速排序 sort/QuickSort (nlogn 不稳定)**
6464

6565
string
66-
3. 无重复字符的最长子串 *** 滑动窗口,Map<Character,Integer>,start = Math.max(start, map.get(c));map.put(c, end+1);res = Math.max(res, end-start+1);
66+
3. 无重复字符的最长子串(返回子串长度) 滑动窗口,Map<Character,Integer>,start = Math.max(start, map.get(c));map.put(c, end+1);res = Math.max(res, end-start+1);
6767
5. 最长回文子串 动态规划 dp[i][j]表示字符串 s 的第 i 到 j 个字母组成的串是否是回文串(x 表示增量,子串长度,)
6868
14. 最长公共前缀 ***
6969
415. 字符串相加
@@ -90,7 +90,7 @@ array
9090
240. 搜索二维矩阵 II 从左下角开始
9191
287. 寻找重复数 排序迭代/快慢指针
9292
448. 找到所有数组中消失的数字 迭代并赋值为-1,最后大于0的既满足(数组中数都大于0)
93-
581. 最短无序连续子数组 排序迭代对比
93+
581. 最短无序连续子数组 排序迭代对比原数组
9494
674. 最长连续递增序列 *** 滑动窗口
9595
704. 二分查找 ***
9696

0 commit comments

Comments
 (0)