Skip to content

Commit a46bee9

Browse files
committed
commit by crawler.py @netcan at 2019-04-05 00:27
1 parent 263521c commit a46bee9

File tree

112 files changed

+880
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+880
-105
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
本项目由`crawler.py`生成,代码自动爬取Leetcode-cn.com网站获取个人提交记录。使用方法:登陆Leetcode后记录cookie,设置环境变量`LEETCODE_COOKIE`,然后执行本脚本就能抓取指定语言的个人提交记录。
66

7-
目前已解决的题目(100 个,其中简单31 个,中等46 个, 困难23 个):
7+
目前已解决的题目(105 个,其中简单31 个,中等50 个, 困难24 个):
88
- [4. Median of Two Sorted Arrays :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0004.%20Median%20of%20Two%20Sorted%20Arrays)
99
- [8. String to Integer (atoi) :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0008.%20String%20to%20Integer%20(atoi))
1010
- [17. Letter Combinations of a Phone Number :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0017.%20Letter%20Combinations%20of%20a%20Phone%20Number)
@@ -43,6 +43,7 @@
4343
- [300. Longest Increasing Subsequence :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0300.%20Longest%20Increasing%20Subsequence)
4444
- [312. Burst Balloons :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0312.%20Burst%20Balloons)
4545
- [315. Count of Smaller Numbers After Self :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0315.%20Count%20of%20Smaller%20Numbers%20After%20Self)
46+
- [322. Coin Change :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0322.%20Coin%20Change)
4647
- [327. Count of Range Sum :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0327.%20Count%20of%20Range%20Sum)
4748
- [334. Increasing Triplet Subsequence :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0334.%20Increasing%20Triplet%20Subsequence)
4849
- [337. House Robber III :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0337.%20House%20Robber%20III)
@@ -60,6 +61,8 @@
6061
- [455. Assign Cookies :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0455.%20Assign%20Cookies)
6162
- [461. Hamming Distance :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0461.%20Hamming%20Distance)
6263
- [463. Island Perimeter :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0463.%20Island%20Perimeter)
64+
- [514. Freedom Trail :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0514.%20Freedom%20Trail)
65+
- [518. Coin Change 2 :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0518.%20Coin%20Change%202)
6366
- [539. Minimum Time Difference :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0539.%20Minimum%20Time%20Difference)
6467
- [563. Binary Tree Tilt :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0563.%20Binary%20Tree%20Tilt)
6568
- [583. Delete Operation for Two Strings :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0583.%20Delete%20Operation%20for%20Two%20Strings)
@@ -75,6 +78,7 @@
7578
- [699. Falling Squares :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0699.%20Falling%20Squares)
7679
- [728. Self Dividing Numbers :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0728.%20Self%20Dividing%20Numbers)
7780
- [744. Find Smallest Letter Greater Than Target :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0744.%20Find%20Smallest%20Letter%20Greater%20Than%20Target)
81+
- [787. Cheapest Flights Within K Stops :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0787.%20Cheapest%20Flights%20Within%20K%20Stops)
7882
- [792. Number of Matching Subsequences :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0792.%20Number%20of%20Matching%20Subsequences)
7983
- [836. Rectangle Overlap :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0836.%20Rectangle%20Overlap)
8084
- [861. Score After Flipping Matrix :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0861.%20Score%20After%20Flipping%20Matrix)
@@ -86,6 +90,7 @@
8690
- [977. Squares of a Sorted Array :star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0977.%20Squares%20of%20a%20Sorted%20Array)
8791
- [980. Unique Paths III :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0980.%20Unique%20Paths%20III)
8892
- [982. Triples with Bitwise AND Equal To Zero :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0982.%20Triples%20with%20Bitwise%20AND%20Equal%20To%20Zero)
93+
- [983. Minimum Cost For Tickets :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0983.%20Minimum%20Cost%20For%20Tickets)
8994
- [991. Broken Calculator :star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0991.%20Broken%20Calculator)
9095
- [995. Minimum Number of K Consecutive Bit Flips :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n0995.%20Minimum%20Number%20of%20K%20Consecutive%20Bit%20Flips)
9196
- [1000. Minimum Cost to Merge Stones :star::star::star:](https://github.com/netcan/Leetcode-Rust/tree/master/n1000.%20Minimum%20Cost%20to%20Merge%20Stones)

crawler.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@
3535
- 通过日期: {time}
3636
3737
### 题目内容
38+
---
3839
{question_content}
3940
4041
### 解法
42+
---
4143
```{lang}
4244
{code}
43-
```
44-
"""
45+
```"""
4546

4647
class Leetcode:
4748
LEETCODE_URL = 'https://leetcode-cn.com'
@@ -150,7 +151,9 @@ def process_submit_list(question_):
150151
if not thread.is_alive():
151152
threads.remove(thread)
152153

153-
def generate_readme(self):
154+
self.__generate_readme()
155+
156+
def __generate_readme(self):
154157
pattern_name = re.compile('n(\d+)\. (.*)')
155158
question_level = {
156159
1: 0, 2: 0, 3: 0
@@ -186,7 +189,6 @@ def generate_readme(self):
186189
lc = Leetcode()
187190

188191
lc.output_source()
189-
lc.generate_readme()
190192

191193
subprocess.run(["git", "add", "."])
192194
subprocess.run(["git", "commit", "-m", "commit by crawler.py @Netcan at {}".format(datetime.now().strftime("%Y-%m-%d %H:%M"))])

n0004. Median of Two Sorted Arrays/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-17 16:56
66

77
### 题目内容
8+
---
89
<p>给定两个大小为 m 和 n 的有序数组 <code>nums1</code> 和 <code>nums2</code>。</p>
910

1011
<p>请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。</p>
@@ -29,6 +30,7 @@ nums2 = [3, 4]
2930

3031

3132
### 解法
33+
---
3234
```rust
3335
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
3436
// Zhihu: https://www.zhihu.com/people/netcan
@@ -61,4 +63,4 @@ impl Solution {
6163
}
6264
}
6365

64-
```
66+
```

n0008. String to Integer (atoi)/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-02-18 18:00
66

77
### 题目内容
8+
---
89
<p>请你来实现一个 <code>atoi</code> 函数,使其能将字符串转换成整数。</p>
910

1011
<p>首先,该函数会根据需要丢弃无用的开头空格字符,直到寻找到第一个非空格的字符为止。</p>
@@ -59,6 +60,7 @@
5960

6061

6162
### 解法
63+
---
6264
```rust
6365
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
6466
// Zhihu: https://www.zhihu.com/people/netcan
@@ -111,4 +113,4 @@ impl Solution {
111113
}
112114

113115

114-
```
116+
```

n0017. Letter Combinations of a Phone Number/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-02-19 19:37
66

77
### 题目内容
8+
---
89
<p>给定一个仅包含数字 <code>2-9</code> 的字符串,返回所有它能表示的字母组合。</p>
910

1011
<p>给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。</p>
@@ -22,6 +23,7 @@
2223

2324

2425
### 解法
26+
---
2527
```rust
2628
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
2729
// Zhihu: https://www.zhihu.com/people/netcan
@@ -66,4 +68,4 @@ impl Solution {
6668
}
6769

6870

69-
```
71+
```

n0036. Valid Sudoku/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-17 09:56
66

77
### 题目内容
8+
---
89
<p>判断一个 9x9 的数独是否有效。只需要<strong>根据以下规则</strong>,验证已经填入的数字是否有效即可。</p>
910

1011
<ol>
@@ -65,6 +66,7 @@
6566

6667

6768
### 解法
69+
---
6870
```rust
6971
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
7072
// Zhihu: https://www.zhihu.com/people/netcan
@@ -99,4 +101,4 @@ impl Solution {
99101
}
100102
}
101103

102-
```
104+
```

n0037. Sudoku Solver/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-12 11:22
66

77
### 题目内容
8+
---
89
<p>编写一个程序,通过已填充的空格来解决数独问题。</p>
910

1011
<p>一个数独的解法需<strong>遵循如下规则</strong>:</p>
@@ -35,6 +36,7 @@
3536

3637

3738
### 解法
39+
---
3840
```rust
3941
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
4042
// Zhihu: https://www.zhihu.com/people/netcan
@@ -103,4 +105,4 @@ impl Solution {
103105
}
104106

105107

106-
```
108+
```

n0050. Pow(x, n)/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-10 23:16
66

77
### 题目内容
8+
---
89
<p>实现 <a href="https://www.cplusplus.com/reference/valarray/pow/" target="_blank">pow(<em>x</em>, <em>n</em>)</a> ,即计算 x 的 n 次幂函数。</p>
910

1011
<p><strong>示例 1:</strong></p>
@@ -34,6 +35,7 @@
3435

3536

3637
### 解法
38+
---
3739
```rust
3840
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
3941
// Zhihu: https://www.zhihu.com/people/netcan
@@ -66,4 +68,4 @@ mod tests {
6668
}
6769
}
6870

69-
```
71+
```

n0051. N-Queens/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-10 12:57
66

77
### 题目内容
8+
---
89
<p><em>n </em>皇后问题研究的是如何将 <em>n</em> 个皇后放置在 <em>n</em>×<em>n</em> 的棋盘上,并且使皇后彼此之间不能相互攻击。</p>
910

1011
<p><img src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/10/12/8-queens.png"></p>
@@ -34,6 +35,7 @@
3435

3536

3637
### 解法
38+
---
3739
```rust
3840
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
3941
// Zhihu: https://www.zhihu.com/people/netcan
@@ -88,4 +90,4 @@ impl Solution {
8890
}
8991
}
9092

91-
```
93+
```

n0052. N-Queens II/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-10 12:44
66

77
### 题目内容
8+
---
89
<p><em>n </em>皇后问题研究的是如何将 <em>n</em> 个皇后放置在 <em>n</em>×<em>n</em> 的棋盘上,并且使皇后彼此之间不能相互攻击。</p>
910

1011
<p><img src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/10/12/8-queens.png" style="height: 276px; width: 258px;"></p>
@@ -33,6 +34,7 @@
3334

3435

3536
### 解法
37+
---
3638
```rust
3739
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
3840
// Zhihu: https://www.zhihu.com/people/netcan
@@ -80,4 +82,4 @@ impl Solution {
8082
}
8183
}
8284

83-
```
85+
```

n0058. Length of Last Word/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-05 19:11
66

77
### 题目内容
8+
---
89
<p>给定一个仅包含大小写字母和空格 <code>' '</code> 的字符串,返回其最后一个单词的长度。</p>
910

1011
<p>如果不存在最后一个单词,请返回 0 。</p>
@@ -19,6 +20,7 @@
1920

2021

2122
### 解法
23+
---
2224
```rust
2325
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
2426
// Zhihu: https://www.zhihu.com/people/netcan
@@ -35,4 +37,4 @@ impl Solution {
3537
}
3638

3739

38-
```
40+
```

n0070. Climbing Stairs/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-05 19:27
66

77
### 题目内容
8+
---
89
<p>假设你正在爬楼梯。需要 <em>n</em> 阶你才能到达楼顶。</p>
910

1011
<p>每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?</p>
@@ -31,6 +32,7 @@
3132

3233

3334
### 解法
35+
---
3436
```rust
3537
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
3638
// Zhihu: https://www.zhihu.com/people/netcan
@@ -48,4 +50,4 @@ impl Solution {
4850
}
4951

5052

51-
```
53+
```

n0071. Simplify Path/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-05 19:51
66

77
### 题目内容
8+
---
89
<p>以 Unix 风格给出一个文件的<strong>绝对路径</strong>,你需要简化它。或者换句话说,将其转换为规范路径。</p>
910

1011
<p>在 Unix 风格的文件系统中,一个点(<code>.</code>)表示当前目录本身;此外,两个点 (<code>..</code>) 表示将目录切换到上一级(指向父目录);两者都可以是复杂相对路径的组成部分。更多信息请参阅:<a href="https://blog.csdn.net/u011327334/article/details/50355600" target="_blank">Linux / Unix中的绝对路径 vs 相对路径</a></p>
@@ -53,6 +54,7 @@
5354

5455

5556
### 解法
57+
---
5658
```rust
5759
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
5860
// Zhihu: https://www.zhihu.com/people/netcan
@@ -112,4 +114,4 @@ mod tests {
112114

113115

114116

115-
```
117+
```

n0072. Edit Distance/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-03-20 18:55
66

77
### 题目内容
8+
---
89
<p>给定两个单词 <em>word1</em> 和 <em>word2</em>,计算出将 <em>word1</em> 转换成 <em>word2 </em>所使用的最少操作数 。</p>
910

1011
<p>你可以对一个单词进行如下三种操作:</p>
@@ -39,6 +40,7 @@ exection -> execution (插入 'u')
3940

4041

4142
### 解法
43+
---
4244
```rust
4345
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
4446
// Zhihu: https://www.zhihu.com/people/netcan
@@ -74,4 +76,4 @@ impl Solution {
7476
}
7577

7678

77-
```
79+
```

n0077. Combinations/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-02-18 16:39
66

77
### 题目内容
8+
---
89
<p>给定两个整数 <em>n</em> 和 <em>k</em>,返回 1 ... <em>n </em>中所有可能的 <em>k</em> 个数的组合。</p>
910

1011
<p><strong>示例:</strong></p>
@@ -22,6 +23,7 @@
2223

2324

2425
### 解法
26+
---
2527
```rust
2628
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
2729
// Zhihu: https://www.zhihu.com/people/netcan
@@ -49,4 +51,4 @@ impl Solution {
4951
}
5052

5153

52-
```
54+
```

n0094. Binary Tree Inorder Traversal/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 通过日期: 2019-02-19 20:44
66

77
### 题目内容
8+
---
89
<p>给定一个二叉树,返回它的<em>中序 </em>遍历。</p>
910

1011
<p><strong>示例:</strong></p>
@@ -22,6 +23,7 @@
2223

2324

2425
### 解法
26+
---
2527
```rust
2628
// Author: Netcan @ https://github.com/netcan/Leetcode-Rust
2729
// Zhihu: https://www.zhihu.com/people/netcan
@@ -45,4 +47,4 @@ impl Solution {
4547
}
4648

4749

48-
```
50+
```

0 commit comments

Comments
 (0)