Skip to content

Commit b0a797f

Browse files
committed
补充第 500 ~ 599 题的题目解析(增加 34 道题)
1 parent 1deca48 commit b0a797f

39 files changed

+3529
-4
lines changed

docs/00_preface/00_05_solutions_list.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# LeetCode 题解(已完成 1016 道)
1+
# LeetCode 题解(已完成 1050 道)
22

33
### 第 1 ~ 99 题
44

@@ -500,34 +500,68 @@
500500

501501
| 标题 | 题解 | 标签 | 难度 |
502502
| :--- | :--- | :--- | :--- |
503+
| [0500. 键盘行](https://leetcode.cn/problems/keyboard-row/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/keyboard-row.md) | 数组、哈希表、字符串 | 简单 |
503504
| [0501. 二叉搜索树中的众数](https://leetcode.cn/problems/find-mode-in-binary-search-tree/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/find-mode-in-binary-search-tree.md) | 树、深度优先搜索、二叉搜索树、二叉树 | 简单 |
504505
| [0503. 下一个更大元素 II](https://leetcode.cn/problems/next-greater-element-ii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/next-greater-element-ii.md) | 栈、数组、单调栈 | 中等 |
505506
| [0504. 七进制数](https://leetcode.cn/problems/base-7/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/base-7.md) | 数学、字符串 | 简单 |
506507
| [0506. 相对名次](https://leetcode.cn/problems/relative-ranks/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/relative-ranks.md) | 数组、排序、堆(优先队列) | 简单 |
508+
| [0507. 完美数](https://leetcode.cn/problems/perfect-number/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/perfect-number.md) | 数学 | 简单 |
509+
| [0508. 出现次数最多的子树元素和](https://leetcode.cn/problems/most-frequent-subtree-sum/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/most-frequent-subtree-sum.md) | 树、深度优先搜索、哈希表、二叉树 | 中等 |
507510
| [0509. 斐波那契数](https://leetcode.cn/problems/fibonacci-number/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/fibonacci-number.md) | 递归、记忆化搜索、数学、动态规划 | 简单 |
508511
| [0513. 找树左下角的值](https://leetcode.cn/problems/find-bottom-left-tree-value/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/find-bottom-left-tree-value.md) | 树、深度优先搜索、广度优先搜索、二叉树 | 中等 |
512+
| [0514. 自由之路](https://leetcode.cn/problems/freedom-trail/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/freedom-trail.md) | 深度优先搜索、广度优先搜索、字符串、动态规划 | 困难 |
509513
| [0515. 在每个树行中找最大值](https://leetcode.cn/problems/find-largest-value-in-each-tree-row/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/find-largest-value-in-each-tree-row.md) | 树、深度优先搜索、广度优先搜索、二叉树 | 中等 |
510514
| [0516. 最长回文子序列](https://leetcode.cn/problems/longest-palindromic-subsequence/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/longest-palindromic-subsequence.md) | 字符串、动态规划 | 中等 |
515+
| [0517. 超级洗衣机](https://leetcode.cn/problems/super-washing-machines/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/super-washing-machines.md) | 贪心、数组 | 困难 |
511516
| [0518. 零钱兑换 II](https://leetcode.cn/problems/coin-change-ii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/coin-change-ii.md) | 数组、动态规划 | 中等 |
517+
| [0519. 随机翻转矩阵](https://leetcode.cn/problems/random-flip-matrix/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/random-flip-matrix.md) | 水塘抽样、哈希表、数学、随机化 | 中等 |
518+
| [0520. 检测大写字母](https://leetcode.cn/problems/detect-capital/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/detect-capital.md) | 字符串 | 简单 |
519+
| [0521. 最长特殊序列 Ⅰ](https://leetcode.cn/problems/longest-uncommon-subsequence-i/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/longest-uncommon-subsequence-i.md) | 字符串 | 简单 |
520+
| [0522. 最长特殊序列 II](https://leetcode.cn/problems/longest-uncommon-subsequence-ii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/longest-uncommon-subsequence-ii.md) | 数组、哈希表、双指针、字符串、排序 | 中等 |
521+
| [0523. 连续的子数组和](https://leetcode.cn/problems/continuous-subarray-sum/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/continuous-subarray-sum.md) | 数组、哈希表、数学、前缀和 | 中等 |
522+
| [0524. 通过删除字母匹配到字典里最长单词](https://leetcode.cn/problems/longest-word-in-dictionary-through-deleting/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/longest-word-in-dictionary-through-deleting.md) | 数组、双指针、字符串、排序 | 中等 |
512523
| [0525. 连续数组](https://leetcode.cn/problems/contiguous-array/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/contiguous-array.md) | 数组、哈希表、前缀和 | 中等 |
513524
| [0526. 优美的排列](https://leetcode.cn/problems/beautiful-arrangement/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/beautiful-arrangement.md) | 位运算、数组、动态规划、回溯、状态压缩 | 中等 |
525+
| [0528. 按权重随机选择](https://leetcode.cn/problems/random-pick-with-weight/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/random-pick-with-weight.md) | 数组、数学、二分查找、前缀和、随机化 | 中等 |
526+
| [0529. 扫雷游戏](https://leetcode.cn/problems/minesweeper/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/minesweeper.md) | 深度优先搜索、广度优先搜索、数组、矩阵 | 中等 |
514527
| [0530. 二叉搜索树的最小绝对差](https://leetcode.cn/problems/minimum-absolute-difference-in-bst/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/minimum-absolute-difference-in-bst.md) | 树、深度优先搜索、广度优先搜索、二叉搜索树、二叉树 | 简单 |
528+
| [0532. 数组中的 k-diff 数对](https://leetcode.cn/problems/k-diff-pairs-in-an-array/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/k-diff-pairs-in-an-array.md) | 数组、哈希表、双指针、二分查找、排序 | 中等 |
529+
| [0535. TinyURL 的加密与解密](https://leetcode.cn/problems/encode-and-decode-tinyurl/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/encode-and-decode-tinyurl.md) | 设计、哈希表、字符串、哈希函数 | 中等 |
530+
| [0537. 复数乘法](https://leetcode.cn/problems/complex-number-multiplication/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/complex-number-multiplication.md) | 数学、字符串、模拟 | 中等 |
515531
| [0538. 把二叉搜索树转换为累加树](https://leetcode.cn/problems/convert-bst-to-greater-tree/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/convert-bst-to-greater-tree.md) | 树、深度优先搜索、二叉搜索树、二叉树 | 中等 |
516532
| [0539. 最小时间差](https://leetcode.cn/problems/minimum-time-difference/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/minimum-time-difference.md) | 数组、数学、字符串、排序 | 中等 |
533+
| [0540. 有序数组中的单一元素](https://leetcode.cn/problems/single-element-in-a-sorted-array/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/single-element-in-a-sorted-array.md) | 数组、二分查找 | 中等 |
534+
| [0541. 反转字符串 II](https://leetcode.cn/problems/reverse-string-ii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/reverse-string-ii.md) | 双指针、字符串 | 简单 |
517535
| [0542. 01 矩阵](https://leetcode.cn/problems/01-matrix/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/01-matrix.md) | 广度优先搜索、数组、动态规划、矩阵 | 中等 |
518536
| [0543. 二叉树的直径](https://leetcode.cn/problems/diameter-of-binary-tree/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/diameter-of-binary-tree.md) | 树、深度优先搜索、二叉树 | 简单 |
519537
| [0546. 移除盒子](https://leetcode.cn/problems/remove-boxes/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/remove-boxes.md) | 记忆化搜索、数组、动态规划 | 困难 |
520538
| [0547. 省份数量](https://leetcode.cn/problems/number-of-provinces/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/number-of-provinces.md) | 深度优先搜索、广度优先搜索、并查集、图 | 中等 |
539+
| [0551. 学生出勤记录 I](https://leetcode.cn/problems/student-attendance-record-i/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/student-attendance-record-i.md) | 字符串 | 简单 |
540+
| [0552. 学生出勤记录 II](https://leetcode.cn/problems/student-attendance-record-ii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/student-attendance-record-ii.md) | 动态规划 | 困难 |
541+
| [0553. 最优除法](https://leetcode.cn/problems/optimal-division/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/optimal-division.md) | 数组、数学、动态规划 | 中等 |
542+
| [0556. 下一个更大元素 III](https://leetcode.cn/problems/next-greater-element-iii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/next-greater-element-iii.md) | 数学、双指针、字符串 | 中等 |
521543
| [0557. 反转字符串中的单词 III](https://leetcode.cn/problems/reverse-words-in-a-string-iii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/reverse-words-in-a-string-iii.md) | 双指针、字符串 | 简单 |
544+
| [0558. 四叉树交集](https://leetcode.cn/problems/logical-or-of-two-binary-grids-represented-as-quad-trees/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/logical-or-of-two-binary-grids-represented-as-quad-trees.md) | 树、分治 | 中等 |
545+
| [0559. N 叉树的最大深度](https://leetcode.cn/problems/maximum-depth-of-n-ary-tree/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/maximum-depth-of-n-ary-tree.md) | 树、深度优先搜索、广度优先搜索 | 简单 |
522546
| [0560. 和为 K 的子数组](https://leetcode.cn/problems/subarray-sum-equals-k/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/subarray-sum-equals-k.md) | 数组、哈希表、前缀和 | 中等 |
523547
| [0561. 数组拆分](https://leetcode.cn/problems/array-partition/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/array-partition.md) | 贪心、数组、计数排序、排序 | 简单 |
548+
| [0563. 二叉树的坡度](https://leetcode.cn/problems/binary-tree-tilt/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/binary-tree-tilt.md) | 树、深度优先搜索、二叉树 | 简单 |
549+
| [0564. 寻找最近的回文数](https://leetcode.cn/problems/find-the-closest-palindrome/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/find-the-closest-palindrome.md) | 数学、字符串 | 困难 |
524550
| [0565. 数组嵌套](https://leetcode.cn/problems/array-nesting/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/array-nesting.md) | 深度优先搜索、数组 | 中等 |
551+
| [0566. 重塑矩阵](https://leetcode.cn/problems/reshape-the-matrix/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/reshape-the-matrix.md) | 数组、矩阵、模拟 | 简单 |
525552
| [0567. 字符串的排列](https://leetcode.cn/problems/permutation-in-string/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/permutation-in-string.md) | 哈希表、双指针、字符串、滑动窗口 | 中等 |
553+
| [0572. 另一棵树的子树](https://leetcode.cn/problems/subtree-of-another-tree/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/subtree-of-another-tree.md) | 树、深度优先搜索、二叉树、字符串匹配、哈希函数 | 简单 |
526554
| [0575. 分糖果](https://leetcode.cn/problems/distribute-candies/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/distribute-candies.md) | 数组、哈希表 | 简单 |
527555
| [0576. 出界的路径数](https://leetcode.cn/problems/out-of-boundary-paths/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/out-of-boundary-paths.md) | 动态规划 | 中等 |
556+
| [0581. 最短无序连续子数组](https://leetcode.cn/problems/shortest-unsorted-continuous-subarray/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/shortest-unsorted-continuous-subarray.md) | 栈、贪心、数组、双指针、排序、单调栈 | 中等 |
528557
| [0583. 两个字符串的删除操作](https://leetcode.cn/problems/delete-operation-for-two-strings/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/delete-operation-for-two-strings.md) | 字符串、动态规划 | 中等 |
558+
| [0587. 安装栅栏](https://leetcode.cn/problems/erect-the-fence/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/erect-the-fence.md) | 几何、数组、数学 | 困难 |
529559
| [0589. N 叉树的前序遍历](https://leetcode.cn/problems/n-ary-tree-preorder-traversal/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/n-ary-tree-preorder-traversal.md) | 栈、树、深度优先搜索 | 简单 |
530560
| [0590. N 叉树的后序遍历](https://leetcode.cn/problems/n-ary-tree-postorder-traversal/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/n-ary-tree-postorder-traversal.md) | 栈、树、深度优先搜索 | 简单 |
561+
| [0591. 标签验证器](https://leetcode.cn/problems/tag-validator/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/tag-validator.md) | 栈、字符串 | 困难 |
562+
| [0592. 分数加减运算](https://leetcode.cn/problems/fraction-addition-and-subtraction/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/fraction-addition-and-subtraction.md) | 数学、字符串、模拟 | 中等 |
563+
| [0593. 有效的正方形](https://leetcode.cn/problems/valid-square/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/valid-square.md) | 几何、数学 | 中等 |
564+
| [0598. 区间加法 II](https://leetcode.cn/problems/range-addition-ii/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/range-addition-ii.md) | 数组、数学 | 简单 |
531565
| [0599. 两个列表的最小索引总和](https://leetcode.cn/problems/minimum-index-sum-of-two-lists/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/minimum-index-sum-of-two-lists.md) | 数组、哈希表、字符串 | 简单 |
532566

533567

docs/01_array/01_03_array_bubble_sort.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ class Solution:
110110

111111
冒泡排序是最简单的排序算法之一,通过相邻元素比较交换实现排序。虽然实现简单,但效率较低。
112112

113-
- **优点**:实现简单,稳定排序,空间复杂度低
114-
- **缺点**:时间复杂度高,交换次数多
113+
- **优点**:实现简单,稳定排序,空间复杂度低
114+
- **缺点**:时间复杂度高,交换次数多
115115

116116
## 练习题目
117117

docs/others/update_time.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2026-01
2+
3+
- 2026-01-01 补充第 500 ~ 599 题的题目解析(增加 34 道题)
4+
15
## 2025-10
26

37
- 2025-10-28 补充第 400 ~ 499 题的题目解析(增加 14 道题)

docs/solutions/0400-0499/diagonal-traverse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
1. 向右上方向移动时:
5656
1. 如果在最后一列,则向下方移动,即 `x += 1`
5757
2. 如果在第一行,则向右方移动,即 `y += 1`
58-
3. 其余情况想右上方向移动,即 `x -= 1``y += 1`
58+
3. 其余情况向右上方向移动,即 `x -= 1``y += 1`
5959
2. 向左下方向移动时:
6060
1. 如果在最后一行,则向右方移动,即 `y += 1`
6161
2. 如果在第一列,则向下方移动,即 `x += 1`

0 commit comments

Comments
 (0)