Skip to content

Commit

Permalink
add some solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
2xiao committed Nov 1, 2023
1 parent 9871448 commit 1232496
Show file tree
Hide file tree
Showing 28 changed files with 290 additions and 69 deletions.
Binary file modified assets/scripts/__pycache__/generate.cpython-312.pyc
Binary file not shown.
9 changes: 5 additions & 4 deletions assets/scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def format_difficulty(difficulty: str, show_emoji: bool = False):
emoji = "🟢"
font = "<font color=#15bd66>Esay</font>"
if show_emoji:
return emoji + " " + font
return emoji + " " + font
return font

# 格式化每一个frame items
Expand Down Expand Up @@ -357,8 +357,9 @@ def gen_tag_and_difficulty(problem_path):
labels = (df.loc[df_indexs[0], "标签"]).split("、")
for label in labels:
problem_label += " [`" + label + "`](../solution/" + label + ".md)"
problem_label += "\n"
problem_difficulty = format_difficulty(df.loc[df_indexs[0], "难度"], True)
problem_label += "\n\n"
problem_difficulty = format_difficulty(
df.loc[df_indexs[0], "难度"], True)

delim = "### 题目\n"
file_path = os.path.join(problem_path, Path(file))
Expand All @@ -370,7 +371,7 @@ def gen_tag_and_difficulty(problem_path):
continue
if "<font color=#15bd66>Esay</font>" in content:
continue

content, after = content.split(delim)
content += problem_difficulty + problem_label + delim + after
Path(file_path).write_text(content, encoding='utf-8')
Expand Down
5 changes: 4 additions & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ module.exports = {
"/leetcode/problem/0070.md",
"/leetcode/problem/0073.md",
"/leetcode/problem/0076.md",
"/leetcode/problem/0080.md"
"/leetcode/problem/0080.md",
"/leetcode/problem/0092.md"
],
},
{
Expand All @@ -112,6 +113,7 @@ module.exports = {
"/leetcode/solution/0100-0199.md",
"/leetcode/problem/0120.md",
"/leetcode/problem/0125.md",
"/leetcode/problem/0143.md",
"/leetcode/problem/0152.md",
"/leetcode/problem/0167.md",
"/leetcode/problem/0189.md",
Expand All @@ -126,6 +128,7 @@ module.exports = {
"/leetcode/problem/0206.md",
"/leetcode/problem/0224.md",
"/leetcode/problem/0227.md",
"/leetcode/problem/0234.md",
"/leetcode/problem/0238.md",
"/leetcode/problem/0259.md",
"/leetcode/problem/0279.md",
Expand Down
Binary file modified docs/.vuepress/public/images/leetcode-js-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/.vuepress/public/images/react-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/leetcode/algorithm/1_recursion.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function f(n) {
| 0118 | [杨辉三角](https://leetcode.com/problems/pascals-triangle/) | | `数组` `动态规划` | <font color=#15bd66>Esay</font> |
| 0119 | [杨辉三角 II](https://leetcode.com/problems/pascals-triangle-ii/) | | `数组` `动态规划` | <font color=#15bd66>Esay</font> |
| 0206 | [反转链表](https://leetcode.com/problems/reverse-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0206) | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | | `链表` | <font color=#ffb800>Medium</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0092) | `链表` | <font color=#ffb800>Medium</font> |
| 0021 | [合并两个有序链表](https://leetcode.com/problems/merge-two-sorted-lists/) | | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0509 | [斐波那契数](https://leetcode.com/problems/fibonacci-number/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0509) | `递归` `记忆化搜索` `数学` `1+` | <font color=#15bd66>Esay</font> |
| 0070 | [爬楼梯](https://leetcode.com/problems/climbing-stairs/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0070) | `记忆化搜索` `数学` `动态规划` | <font color=#15bd66>Esay</font> |
Expand Down
2 changes: 1 addition & 1 deletion docs/leetcode/algorithm/9_two_pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
| 0019 | [删除链表的倒数第 N 个结点](https://leetcode.com/problems/remove-nth-node-from-end-of-list/) | | `链表` `双指针` | <font color=#ffb800>Medium</font> |
| 0876 | [链表的中间结点](https://leetcode.com/problems/middle-of-the-linked-list/) | | `链表` `双指针` | <font color=#15bd66>Esay</font> |
| 剑指 Offer 22 | [链表中倒数第k个节点](https://leetcode.cn/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/) | | `链表` `双指针` | <font color=#15bd66>Esay</font> |
| 0143 | [重排链表](https://leetcode.com/problems/reorder-list/) | | `` `递归` `链表` `1+` | <font color=#ffb800>Medium</font> |
| 0143 | [重排链表](https://leetcode.com/problems/reorder-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0143) | `` `递归` `链表` `1+` | <font color=#ffb800>Medium</font> |
| 0002 | [两数相加](https://leetcode.com/problems/add-two-numbers/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0002) | `递归` `链表` `数学` | <font color=#ffb800>Medium</font> |
| 0445 | [两数相加 II](https://leetcode.com/problems/add-two-numbers-ii/) | | `` `链表` `数学` | <font color=#ffb800>Medium</font> |

4 changes: 2 additions & 2 deletions docs/leetcode/ds/1_linked_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ singleLinkedList {
| 0083 | [删除排序链表中的重复元素](https://leetcode.com/problems/remove-duplicates-from-sorted-list/) | | `链表` | <font color=#15bd66>Esay</font> |
| 0082 | [删除排序链表中的重复元素 II](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/) | | `链表` `双指针` | <font color=#ffb800>Medium</font> |
| 0206 | [反转链表](https://leetcode.com/problems/reverse-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0206) | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | | `链表` | <font color=#ffb800>Medium</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0092) | `链表` | <font color=#ffb800>Medium</font> |
| 0025 | [K 个一组翻转链表](https://leetcode.com/problems/reverse-nodes-in-k-group/) | | `递归` `链表` | <font color=#ff334b>Hard</font> |
| 0203 | [移除链表元素](https://leetcode.com/problems/remove-linked-list-elements/) | | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0328 | [奇偶链表](https://leetcode.com/problems/odd-even-linked-list/) | | `链表` | <font color=#ffb800>Medium</font> |
| 0234 | [回文链表](https://leetcode.com/problems/palindrome-linked-list/) | | `` `递归` `链表` `1+` | <font color=#15bd66>Esay</font> |
| 0234 | [回文链表](https://leetcode.com/problems/palindrome-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0234) | `` `递归` `链表` `1+` | <font color=#15bd66>Esay</font> |
| 0430 | [扁平化多级双向链表](https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/) | | `深度优先搜索` `链表` `双向链表` | <font color=#ffb800>Medium</font> |
| 0138 | [复制带随机指针的链表](https://leetcode.com/problems/copy-list-with-random-pointer/) | | `哈希表` `链表` | <font color=#ffb800>Medium</font> |
| 0061 | [旋转链表](https://leetcode.com/problems/rotate-list/) | | `链表` `双指针` | <font color=#ffb800>Medium</font> |
Expand Down
5 changes: 4 additions & 1 deletion docs/leetcode/outline/2_solution_list.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 1.3 LeetCode 题解

已完成 55
已完成 58

| 题号 | 标题 | 题解 | 标签 | 难度 |
| :------ | :------ | :------ | :------ | :------ |
Expand Down Expand Up @@ -32,15 +32,18 @@
| 0073 | [矩阵置零](https://leetcode.com/problems/set-matrix-zeroes/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0073) | `数组` `哈希表` `矩阵` | <font color=#ffb800>Medium</font> |
| 0076 | [最小覆盖子串](https://leetcode.com/problems/minimum-window-substring/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0076) | `哈希表` `字符串` `滑动窗口` | <font color=#ff334b>Hard</font> |
| 0080 | [删除有序数组中的重复项 II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0080) | `数组` `双指针` | <font color=#ffb800>Medium</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0092) | `链表` | <font color=#ffb800>Medium</font> |
| 0120 | [三角形最小路径和](https://leetcode.com/problems/triangle/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0120) | `数组` `动态规划` | <font color=#ffb800>Medium</font> |
| 0125 | [验证回文串](https://leetcode.com/problems/valid-palindrome/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0125) | `双指针` `字符串` | <font color=#15bd66>Esay</font> |
| 0143 | [重排链表](https://leetcode.com/problems/reorder-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0143) | `` `递归` `链表` `1+` | <font color=#ffb800>Medium</font> |
| 0152 | [乘积最大子数组](https://leetcode.com/problems/maximum-product-subarray/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0152) | `数组` `动态规划` | <font color=#ffb800>Medium</font> |
| 0167 | [两数之和 II - 输入有序数组](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0167) | `数组` `双指针` `二分查找` | <font color=#ffb800>Medium</font> |
| 0189 | [轮转数组](https://leetcode.com/problems/rotate-array/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0189) | `数组` `数学` `双指针` | <font color=#ffb800>Medium</font> |
| 0190 | [颠倒二进制位](https://leetcode.com/problems/reverse-bits/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0190) | `位运算` `分治` | <font color=#15bd66>Esay</font> |
| 0206 | [反转链表](https://leetcode.com/problems/reverse-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0206) | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0224 | [基本计算器](https://leetcode.com/problems/basic-calculator/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0224) | `` `递归` `数学` `1+` | <font color=#ff334b>Hard</font> |
| 0227 | [基本计算器 II](https://leetcode.com/problems/basic-calculator-ii/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0227) | `` `数学` `字符串` | <font color=#ffb800>Medium</font> |
| 0234 | [回文链表](https://leetcode.com/problems/palindrome-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0234) | `` `递归` `链表` `1+` | <font color=#15bd66>Esay</font> |
| 0238 | [除自身以外数组的乘积](https://leetcode.com/problems/product-of-array-except-self/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0238) | `数组` `前缀和` | <font color=#ffb800>Medium</font> |
| 0259 | [较小的三数之和](https://leetcode.com/problems/3sum-smaller/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0259) | `数组` `双指针` `二分查找` `1+` | <font color=#ffb800>Medium</font> |
| 0279 | [完全平方数](https://leetcode.com/problems/perfect-squares/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0279) | `广度优先搜索` `数学` `动态规划` | <font color=#ffb800>Medium</font> |
Expand Down
8 changes: 4 additions & 4 deletions docs/leetcode/outline/3_categories_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
| 0083 | [删除排序链表中的重复元素](https://leetcode.com/problems/remove-duplicates-from-sorted-list/) | | `链表` | <font color=#15bd66>Esay</font> |
| 0082 | [删除排序链表中的重复元素 II](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/) | | `链表` `双指针` | <font color=#ffb800>Medium</font> |
| 0206 | [反转链表](https://leetcode.com/problems/reverse-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0206) | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | | `链表` | <font color=#ffb800>Medium</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0092) | `链表` | <font color=#ffb800>Medium</font> |
| 0025 | [K 个一组翻转链表](https://leetcode.com/problems/reverse-nodes-in-k-group/) | | `递归` `链表` | <font color=#ff334b>Hard</font> |
| 0203 | [移除链表元素](https://leetcode.com/problems/remove-linked-list-elements/) | | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0328 | [奇偶链表](https://leetcode.com/problems/odd-even-linked-list/) | | `链表` | <font color=#ffb800>Medium</font> |
| 0234 | [回文链表](https://leetcode.com/problems/palindrome-linked-list/) | | `` `递归` `链表` `1+` | <font color=#15bd66>Esay</font> |
| 0234 | [回文链表](https://leetcode.com/problems/palindrome-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0234) | `` `递归` `链表` `1+` | <font color=#15bd66>Esay</font> |
| 0430 | [扁平化多级双向链表](https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list/) | | `深度优先搜索` `链表` `双向链表` | <font color=#ffb800>Medium</font> |
| 0138 | [复制带随机指针的链表](https://leetcode.com/problems/copy-list-with-random-pointer/) | | `哈希表` `链表` | <font color=#ffb800>Medium</font> |
| 0061 | [旋转链表](https://leetcode.com/problems/rotate-list/) | | `链表` `双指针` | <font color=#ffb800>Medium</font> |
Expand Down Expand Up @@ -481,7 +481,7 @@
| 0118 | [杨辉三角](https://leetcode.com/problems/pascals-triangle/) | | `数组` `动态规划` | <font color=#15bd66>Esay</font> |
| 0119 | [杨辉三角 II](https://leetcode.com/problems/pascals-triangle-ii/) | | `数组` `动态规划` | <font color=#15bd66>Esay</font> |
| 0206 | [反转链表](https://leetcode.com/problems/reverse-linked-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0206) | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | | `链表` | <font color=#ffb800>Medium</font> |
| 0092 | [反转链表 II](https://leetcode.com/problems/reverse-linked-list-ii/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0092) | `链表` | <font color=#ffb800>Medium</font> |
| 0021 | [合并两个有序链表](https://leetcode.com/problems/merge-two-sorted-lists/) | | `递归` `链表` | <font color=#15bd66>Esay</font> |
| 0509 | [斐波那契数](https://leetcode.com/problems/fibonacci-number/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0509) | `递归` `记忆化搜索` `数学` `1+` | <font color=#15bd66>Esay</font> |
| 0070 | [爬楼梯](https://leetcode.com/problems/climbing-stairs/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0070) | `记忆化搜索` `数学` `动态规划` | <font color=#15bd66>Esay</font> |
Expand Down Expand Up @@ -1089,7 +1089,7 @@
| 0019 | [删除链表的倒数第 N 个结点](https://leetcode.com/problems/remove-nth-node-from-end-of-list/) | | `链表` `双指针` | <font color=#ffb800>Medium</font> |
| 0876 | [链表的中间结点](https://leetcode.com/problems/middle-of-the-linked-list/) | | `链表` `双指针` | <font color=#15bd66>Esay</font> |
| 剑指 Offer 22 | [链表中倒数第k个节点](https://leetcode.cn/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/) | | `链表` `双指针` | <font color=#15bd66>Esay</font> |
| 0143 | [重排链表](https://leetcode.com/problems/reorder-list/) | | `` `递归` `链表` `1+` | <font color=#ffb800>Medium</font> |
| 0143 | [重排链表](https://leetcode.com/problems/reorder-list/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0143) | `` `递归` `链表` `1+` | <font color=#ffb800>Medium</font> |
| 0002 | [两数相加](https://leetcode.com/problems/add-two-numbers/) | [JS](https://2xiao.github.io/leetcode-js/leetcode/problem/0002) | `递归` `链表` `数学` | <font color=#ffb800>Medium</font> |
| 0445 | [两数相加 II](https://leetcode.com/problems/add-two-numbers-ii/) | | `` `链表` `数学` | <font color=#ffb800>Medium</font> |

Expand Down
Loading

0 comments on commit 1232496

Please sign in to comment.