|
1 | | -# LeetCode 题解(已完成 1016 道) |
| 1 | +# LeetCode 题解(已完成 1050 道) |
2 | 2 |
|
3 | 3 | ### 第 1 ~ 99 题 |
4 | 4 |
|
|
500 | 500 |
|
501 | 501 | | 标题 | 题解 | 标签 | 难度 | |
502 | 502 | | :--- | :--- | :--- | :--- | |
| 503 | +| [0500. 键盘行](https://leetcode.cn/problems/keyboard-row/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/keyboard-row.md) | 数组、哈希表、字符串 | 简单 | |
503 | 504 | | [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) | 树、深度优先搜索、二叉搜索树、二叉树 | 简单 | |
504 | 505 | | [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) | 栈、数组、单调栈 | 中等 | |
505 | 506 | | [0504. 七进制数](https://leetcode.cn/problems/base-7/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/base-7.md) | 数学、字符串 | 简单 | |
506 | 507 | | [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) | 树、深度优先搜索、哈希表、二叉树 | 中等 | |
507 | 510 | | [0509. 斐波那契数](https://leetcode.cn/problems/fibonacci-number/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/fibonacci-number.md) | 递归、记忆化搜索、数学、动态规划 | 简单 | |
508 | 511 | | [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) | 深度优先搜索、广度优先搜索、字符串、动态规划 | 困难 | |
509 | 513 | | [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) | 树、深度优先搜索、广度优先搜索、二叉树 | 中等 | |
510 | 514 | | [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) | 贪心、数组 | 困难 | |
511 | 516 | | [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) | 数组、双指针、字符串、排序 | 中等 | |
512 | 523 | | [0525. 连续数组](https://leetcode.cn/problems/contiguous-array/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/contiguous-array.md) | 数组、哈希表、前缀和 | 中等 | |
513 | 524 | | [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) | 深度优先搜索、广度优先搜索、数组、矩阵 | 中等 | |
514 | 527 | | [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) | 数学、字符串、模拟 | 中等 | |
515 | 531 | | [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) | 树、深度优先搜索、二叉搜索树、二叉树 | 中等 | |
516 | 532 | | [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) | 双指针、字符串 | 简单 | |
517 | 535 | | [0542. 01 矩阵](https://leetcode.cn/problems/01-matrix/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/01-matrix.md) | 广度优先搜索、数组、动态规划、矩阵 | 中等 | |
518 | 536 | | [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) | 树、深度优先搜索、二叉树 | 简单 | |
519 | 537 | | [0546. 移除盒子](https://leetcode.cn/problems/remove-boxes/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/remove-boxes.md) | 记忆化搜索、数组、动态规划 | 困难 | |
520 | 538 | | [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) | 数学、双指针、字符串 | 中等 | |
521 | 543 | | [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) | 树、深度优先搜索、广度优先搜索 | 简单 | |
522 | 546 | | [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) | 数组、哈希表、前缀和 | 中等 | |
523 | 547 | | [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) | 数学、字符串 | 困难 | |
524 | 550 | | [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) | 数组、矩阵、模拟 | 简单 | |
525 | 552 | | [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) | 树、深度优先搜索、二叉树、字符串匹配、哈希函数 | 简单 | |
526 | 554 | | [0575. 分糖果](https://leetcode.cn/problems/distribute-candies/) | [题解](https://github.com/ITCharge/AlgoNote/tree/main/docs/solutions/0500-0599/distribute-candies.md) | 数组、哈希表 | 简单 | |
527 | 555 | | [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) | 栈、贪心、数组、双指针、排序、单调栈 | 中等 | |
528 | 557 | | [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) | 几何、数组、数学 | 困难 | |
529 | 559 | | [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) | 栈、树、深度优先搜索 | 简单 | |
530 | 560 | | [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) | 数组、数学 | 简单 | |
531 | 565 | | [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) | 数组、哈希表、字符串 | 简单 | |
532 | 566 |
|
533 | 567 |
|
|
0 commit comments