Skip to content

Commit

Permalink
add 15 solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
2xiao committed Jan 23, 2025
1 parent 0dd1e96 commit e2bf4ac
Show file tree
Hide file tree
Showing 53 changed files with 2,786 additions and 70 deletions.
15 changes: 15 additions & 0 deletions src/.vuepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,22 @@ export default sidebar({
"0300",
"0303",
"0304",
"0306",
"0307",
"0309",
"0310",
"0313",
"0316",
"0318",
"0319",
"0322",
"0326",
"0328",
"0331",
"0334",
"0337",
"0338",
"0341",
"0342",
"0343",
"0344",
Expand All @@ -296,6 +304,7 @@ export default sidebar({
"0350",
"0354",
"0355",
"0357",
"0366",
"0367",
"0369",
Expand All @@ -322,6 +331,7 @@ export default sidebar({
"0401",
"0404",
"0405",
"0407",
"0409",
"0412",
"0414",
Expand Down Expand Up @@ -624,6 +634,7 @@ export default sidebar({
"1252",
"1260",
"1266",
"1267",
"1268",
"1275",
"1277",
Expand Down Expand Up @@ -787,6 +798,7 @@ export default sidebar({
"1758",
"1760",
"1763",
"1765",
"1768",
"1769",
"1773",
Expand Down Expand Up @@ -865,6 +877,7 @@ export default sidebar({
"2006",
"2011",
"2016",
"2017",
"2022",
"2027",
"2032",
Expand Down Expand Up @@ -1050,12 +1063,14 @@ export default sidebar({
"2649",
"2650",
"2657",
"2661",
"2665",
"2666",
"2667",
"2675",
"2676",
"2677",
"2683",
"2684",
"2690",
"2691",
Expand Down
6 changes: 3 additions & 3 deletions src/book/dynamic_programming.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
| 1245 | 树的直径 🔒 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `2+` | 🟠 | [🀄️](https://leetcode.cn/problems/tree-diameter) [🔗](https://leetcode.com/problems/tree-diameter) |
| 2246 | 相邻字符不同的最长路径 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [``](/tag/graph.md) `3+` | 🔴 | [🀄️](https://leetcode.cn/problems/longest-path-with-different-adjacent-characters) [🔗](https://leetcode.com/problems/longest-path-with-different-adjacent-characters) |
| 687 | 最长同值路径 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`二叉树`](/tag/binary-tree.md) | 🟠 | [🀄️](https://leetcode.cn/problems/longest-univalue-path) [🔗](https://leetcode.com/problems/longest-univalue-path) |
| 337 | 打家劫舍 III | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`动态规划`](/tag/dynamic-programming.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/house-robber-iii) [🔗](https://leetcode.com/problems/house-robber-iii) |
| 337 | 打家劫舍 III | [[]](/problem/0337.md) | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`动态规划`](/tag/dynamic-programming.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/house-robber-iii) [🔗](https://leetcode.com/problems/house-robber-iii) |
| 333 | 最大二叉搜索子树 🔒 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`二叉搜索树`](/tag/binary-search-tree.md) `2+` | 🟠 | [🀄️](https://leetcode.cn/problems/largest-bst-subtree) [🔗](https://leetcode.com/problems/largest-bst-subtree) |
| 1617 | 统计子树中城市之间最大距离 | | [`位运算`](/tag/bit-manipulation.md) [``](/tag/tree.md) [`动态规划`](/tag/dynamic-programming.md) `2+` | 🔴 | [🀄️](https://leetcode.cn/problems/count-subtrees-with-max-distance-between-cities) [🔗](https://leetcode.com/problems/count-subtrees-with-max-distance-between-cities) |
| 2538 | 最大价值和与最小价值和的差值 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`数组`](/tag/array.md) `1+` | 🔴 | [🀄️](https://leetcode.cn/problems/difference-between-maximum-and-minimum-price-sum) [🔗](https://leetcode.com/problems/difference-between-maximum-and-minimum-price-sum) |
Expand All @@ -247,7 +247,7 @@
<!-- prettier-ignore -->
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
| :------: | :------ | :------: | :------ | :------: | :------: |
| 310 | 最小高度树 | | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [``](/tag/graph.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/minimum-height-trees) [🔗](https://leetcode.com/problems/minimum-height-trees) |
| 310 | 最小高度树 | [[]](/problem/0310.md) | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [``](/tag/graph.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/minimum-height-trees) [🔗](https://leetcode.com/problems/minimum-height-trees) |
| 834 | 树中距离之和 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [``](/tag/graph.md) `1+` | 🔴 | [🀄️](https://leetcode.cn/problems/sum-of-distances-in-tree) [🔗](https://leetcode.com/problems/sum-of-distances-in-tree) |
| 2581 | 统计可能的树根数目 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`数组`](/tag/array.md) `2+` | 🔴 | [🀄️](https://leetcode.cn/problems/count-number-of-possible-root-nodes) [🔗](https://leetcode.com/problems/count-number-of-possible-root-nodes) |

Expand Down Expand Up @@ -300,7 +300,7 @@
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
| :------: | :------ | :------: | :------ | :------: | :------: |
| 2376 | 统计特殊整数 | | [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) | 🔴 | [🀄️](https://leetcode.cn/problems/count-special-integers) [🔗](https://leetcode.com/problems/count-special-integers) |
| 357 | 统计各位数字都不同的数字个数 | | [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) [`回溯`](/tag/backtracking.md) | 🟠 | [🀄️](https://leetcode.cn/problems/count-numbers-with-unique-digits) [🔗](https://leetcode.com/problems/count-numbers-with-unique-digits) |
| 357 | 统计各位数字都不同的数字个数 | [[]](/problem/0357.md) | [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) [`回溯`](/tag/backtracking.md) | 🟠 | [🀄️](https://leetcode.cn/problems/count-numbers-with-unique-digits) [🔗](https://leetcode.com/problems/count-numbers-with-unique-digits) |
| 1012 | 至少有 1 位重复的数字 | | [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) | 🔴 | [🀄️](https://leetcode.cn/problems/numbers-with-repeated-digits) [🔗](https://leetcode.com/problems/numbers-with-repeated-digits) |
| 902 | 最大为 N 的数字组合 | | [`数组`](/tag/array.md) [`数学`](/tag/math.md) [`字符串`](/tag/string.md) `2+` | 🔴 | [🀄️](https://leetcode.cn/problems/numbers-at-most-n-given-digit-set) [🔗](https://leetcode.com/problems/numbers-at-most-n-given-digit-set) |
| 788 | 旋转数字 | | [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) | 🟠 | [🀄️](https://leetcode.cn/problems/rotated-digits) [🔗](https://leetcode.com/problems/rotated-digits) |
Expand Down
2 changes: 1 addition & 1 deletion src/book/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<!-- prettier-ignore -->
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
| :------: | :------ | :------: | :------ | :------: | :------: |
| 407 | 接雨水 II | | [`广度优先搜索`](/tag/breadth-first-search.md) [`数组`](/tag/array.md) [`矩阵`](/tag/matrix.md) `1+` | 🔴 | [🀄️](https://leetcode.cn/problems/trapping-rain-water-ii) [🔗](https://leetcode.com/problems/trapping-rain-water-ii) |
| 407 | 接雨水 II | [[]](/problem/0407.md) | [`广度优先搜索`](/tag/breadth-first-search.md) [`数组`](/tag/array.md) [`矩阵`](/tag/matrix.md) `1+` | 🔴 | [🀄️](https://leetcode.cn/problems/trapping-rain-water-ii) [🔗](https://leetcode.com/problems/trapping-rain-water-ii) |
| 743 | 网络延迟时间 | | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [``](/tag/graph.md) `2+` | 🟠 | [🀄️](https://leetcode.cn/problems/network-delay-time) [🔗](https://leetcode.com/problems/network-delay-time) |
| 787 | K 站中转内最便宜的航班 | | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [``](/tag/graph.md) `3+` | 🟠 | [🀄️](https://leetcode.cn/problems/cheapest-flights-within-k-stops) [🔗](https://leetcode.com/problems/cheapest-flights-within-k-stops) |
| 1631 | 最小体力消耗路径 | | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`并查集`](/tag/union-find.md) `4+` | 🟠 | [🀄️](https://leetcode.cn/problems/path-with-minimum-effort) [🔗](https://leetcode.com/problems/path-with-minimum-effort) |
Expand Down
2 changes: 1 addition & 1 deletion src/plan/company_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ headerDepth: 0
| 987 | 二叉树的垂序遍历 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `3+` | 🔴 | [🀄️](https://leetcode.cn/problems/vertical-order-traversal-of-a-binary-tree) [🔗](https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree) | 9 |
| 105 | 从前序与中序遍历序列构造二叉树 | [[]](/problem/0105.md) | [``](/tag/tree.md) [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) `2+` | 🟠 | [🀄️](https://leetcode.cn/problems/construct-binary-tree-from-preorder-and-inorder-traversal) [🔗](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal) | 9 |
| 442 | 数组中重复的数据 | [[]](/problem/0442.md) | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) | 🟠 | [🀄️](https://leetcode.cn/problems/find-all-duplicates-in-an-array) [🔗](https://leetcode.com/problems/find-all-duplicates-in-an-array) | 9 |
| 341 | 扁平化嵌套列表迭代器 | | [``](/tag/stack.md) [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) `3+` | 🟠 | [🀄️](https://leetcode.cn/problems/flatten-nested-list-iterator) [🔗](https://leetcode.com/problems/flatten-nested-list-iterator) | 8 |
| 341 | 扁平化嵌套列表迭代器 | [[]](/problem/0341.md) | [``](/tag/stack.md) [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) `3+` | 🟠 | [🀄️](https://leetcode.cn/problems/flatten-nested-list-iterator) [🔗](https://leetcode.com/problems/flatten-nested-list-iterator) | 8 |
| 33 | 搜索旋转排序数组 | [[]](/problem/0033.md) | [`数组`](/tag/array.md) [`二分查找`](/tag/binary-search.md) | 🟠 | [🀄️](https://leetcode.cn/problems/search-in-rotated-sorted-array) [🔗](https://leetcode.com/problems/search-in-rotated-sorted-array) | 7 |
| 487 | 最大连续1的个数 II 🔒 | | [`数组`](/tag/array.md) [`动态规划`](/tag/dynamic-programming.md) [`滑动窗口`](/tag/sliding-window.md) | 🟠 | [🀄️](https://leetcode.cn/problems/max-consecutive-ones-ii) [🔗](https://leetcode.com/problems/max-consecutive-ones-ii) | 1 |

Expand Down
10 changes: 5 additions & 5 deletions src/plan/contest_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ headerDepth: 0
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
| :------: | :------ | :------: | :------ | :------: | :------: |
| 2682 | 找出转圈游戏输家 | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`模拟`](/tag/simulation.md) | 🟢 | [🀄️](https://leetcode.cn/problems/find-the-losers-of-the-circular-game) [🔗](https://leetcode.com/problems/find-the-losers-of-the-circular-game) |
| 2683 | 相邻值的按位异或 | | [`位运算`](/tag/bit-manipulation.md) [`数组`](/tag/array.md) | 🟠 | [🀄️](https://leetcode.cn/problems/neighboring-bitwise-xor) [🔗](https://leetcode.com/problems/neighboring-bitwise-xor) |
| 2683 | 相邻值的按位异或 | [[✓]](/problem/2683.md) | [`位运算`](/tag/bit-manipulation.md) [`数组`](/tag/array.md) | 🟠 | [🀄️](https://leetcode.cn/problems/neighboring-bitwise-xor) [🔗](https://leetcode.com/problems/neighboring-bitwise-xor) |
| 2684 | 矩阵中移动的最大次数 | [[✓]](/problem/2684.md) | [`数组`](/tag/array.md) [`动态规划`](/tag/dynamic-programming.md) [`矩阵`](/tag/matrix.md) | 🟠 | [🀄️](https://leetcode.cn/problems/maximum-number-of-moves-in-a-grid) [🔗](https://leetcode.com/problems/maximum-number-of-moves-in-a-grid) |
| 2685 | 统计完全连通分量的数量 | | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`图`](/tag/graph.md) | 🟠 | [🀄️](https://leetcode.cn/problems/count-the-number-of-complete-components) [🔗](https://leetcode.com/problems/count-the-number-of-complete-components) |

Expand Down Expand Up @@ -1392,7 +1392,7 @@ headerDepth: 0
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
| :------: | :------ | :------: | :------ | :------: | :------: |
| 2660 | 保龄球游戏的获胜者 | | [`数组`](/tag/array.md) [`模拟`](/tag/simulation.md) | 🟢 | [🀄️](https://leetcode.cn/problems/determine-the-winner-of-a-bowling-game) [🔗](https://leetcode.com/problems/determine-the-winner-of-a-bowling-game) |
| 2661 | 找出叠涂元素 | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`矩阵`](/tag/matrix.md) | 🟠 | [🀄️](https://leetcode.cn/problems/first-completely-painted-row-or-column) [🔗](https://leetcode.com/problems/first-completely-painted-row-or-column) |
| 2661 | 找出叠涂元素 | [[✓]](/problem/2661.md) | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`矩阵`](/tag/matrix.md) | 🟠 | [🀄️](https://leetcode.cn/problems/first-completely-painted-row-or-column) [🔗](https://leetcode.com/problems/first-completely-painted-row-or-column) |
| 2662 | 前往目标的最小代价 | | [`图`](/tag/graph.md) [`数组`](/tag/array.md) [`最短路`](/tag/shortest-path.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/minimum-cost-of-a-path-with-special-roads) [🔗](https://leetcode.com/problems/minimum-cost-of-a-path-with-special-roads) |
| 2663 | 字典序最小的美丽字符串 | | [`贪心`](/tag/greedy.md) [`字符串`](/tag/string.md) | 🔴 | [🀄️](https://leetcode.cn/problems/lexicographically-smallest-beautiful-string) [🔗](https://leetcode.com/problems/lexicographically-smallest-beautiful-string) |

Expand Down Expand Up @@ -2892,7 +2892,7 @@ headerDepth: 0
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
| :------: | :------ | :------: | :------ | :------: | :------: |
| 2016 | 增量元素之间的最大差值 | [[✓]](/problem/2016.md) | [`数组`](/tag/array.md) | 🟢 | [🀄️](https://leetcode.cn/problems/maximum-difference-between-increasing-elements) [🔗](https://leetcode.com/problems/maximum-difference-between-increasing-elements) |
| 2017 | 网格游戏 | | [`数组`](/tag/array.md) [`矩阵`](/tag/matrix.md) [`前缀和`](/tag/prefix-sum.md) | 🟠 | [🀄️](https://leetcode.cn/problems/grid-game) [🔗](https://leetcode.com/problems/grid-game) |
| 2017 | 网格游戏 | [[✓]](/problem/2017.md) | [`数组`](/tag/array.md) [`矩阵`](/tag/matrix.md) [`前缀和`](/tag/prefix-sum.md) | 🟠 | [🀄️](https://leetcode.cn/problems/grid-game) [🔗](https://leetcode.com/problems/grid-game) |
| 2018 | 判断单词是否能放入填字游戏内 | | [`数组`](/tag/array.md) [`枚举`](/tag/enumeration.md) [`矩阵`](/tag/matrix.md) | 🟠 | [🀄️](https://leetcode.cn/problems/check-if-word-can-be-placed-in-crossword) [🔗](https://leetcode.com/problems/check-if-word-can-be-placed-in-crossword) |
| 2019 | 解出数学表达式的学生分数 | | [`栈`](/tag/stack.md) [`记忆化搜索`](/tag/memoization.md) [`数组`](/tag/array.md) `3+` | 🔴 | [🀄️](https://leetcode.cn/problems/the-score-of-students-solving-math-expression) [🔗](https://leetcode.com/problems/the-score-of-students-solving-math-expression) |

Expand Down Expand Up @@ -3457,7 +3457,7 @@ headerDepth: 0
| :------: | :------ | :------: | :------ | :------: | :------: |
| 1763 | 最长的美好子字符串 | [[✓]](/problem/1763.md) | [`位运算`](/tag/bit-manipulation.md) [`哈希表`](/tag/hash-table.md) [`字符串`](/tag/string.md) `2+` | 🟢 | [🀄️](https://leetcode.cn/problems/longest-nice-substring) [🔗](https://leetcode.com/problems/longest-nice-substring) |
| 1764 | 通过连接另一个数组的子数组得到一个数组 | | [`贪心`](/tag/greedy.md) [`数组`](/tag/array.md) [`双指针`](/tag/two-pointers.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/form-array-by-concatenating-subarrays-of-another-array) [🔗](https://leetcode.com/problems/form-array-by-concatenating-subarrays-of-another-array) |
| 1765 | 地图中的最高点 | | [`广度优先搜索`](/tag/breadth-first-search.md) [`数组`](/tag/array.md) [`矩阵`](/tag/matrix.md) | 🟠 | [🀄️](https://leetcode.cn/problems/map-of-highest-peak) [🔗](https://leetcode.com/problems/map-of-highest-peak) |
| 1765 | 地图中的最高点 | [[✓]](/problem/1765.md) | [`广度优先搜索`](/tag/breadth-first-search.md) [`数组`](/tag/array.md) [`矩阵`](/tag/matrix.md) | 🟠 | [🀄️](https://leetcode.cn/problems/map-of-highest-peak) [🔗](https://leetcode.com/problems/map-of-highest-peak) |
| 1766 | 互质树 | | [`树`](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`数组`](/tag/array.md) `2+` | 🔴 | [🀄️](https://leetcode.cn/problems/tree-of-coprimes) [🔗](https://leetcode.com/problems/tree-of-coprimes) |


Expand Down Expand Up @@ -4620,7 +4620,7 @@ headerDepth: 0
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
| :------: | :------ | :------: | :------ | :------: | :------: |
| 1266 | 访问所有点的最小时间 | [[✓]](/problem/1266.md) | [`几何`](/tag/geometry.md) [`数组`](/tag/array.md) [`数学`](/tag/math.md) | 🟢 | [🀄️](https://leetcode.cn/problems/minimum-time-visiting-all-points) [🔗](https://leetcode.com/problems/minimum-time-visiting-all-points) |
| 1267 | 统计参与通信的服务器 | | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`并查集`](/tag/union-find.md) `3+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-servers-that-communicate) [🔗](https://leetcode.com/problems/count-servers-that-communicate) |
| 1267 | 统计参与通信的服务器 | [[✓]](/problem/1267.md) | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`并查集`](/tag/union-find.md) `3+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-servers-that-communicate) [🔗](https://leetcode.com/problems/count-servers-that-communicate) |
| 1268 | 搜索推荐系统 | [[✓]](/problem/1268.md) | [`字典树`](/tag/trie.md) [`数组`](/tag/array.md) [`字符串`](/tag/string.md) `3+` | 🟠 | [🀄️](https://leetcode.cn/problems/search-suggestions-system) [🔗](https://leetcode.com/problems/search-suggestions-system) |
| 1269 | 停在原地的方案数 | | [`动态规划`](/tag/dynamic-programming.md) | 🔴 | [🀄️](https://leetcode.cn/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps) [🔗](https://leetcode.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps) |

Expand Down
Loading

0 comments on commit e2bf4ac

Please sign in to comment.