Skip to content

Commit 979edb1

Browse files
committed
add 1963
1 parent 38af94b commit 979edb1

Some content is hidden

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

82 files changed

+4409
-7340
lines changed

assets/output/3313.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# [3313. Find the Last Marked Nodes in Tree](https://leetcode.com/problems/find-the-last-marked-nodes-in-tree)
2+
3+
🔴 <font color=#ff334b>Hard</font>&emsp; 🔖&ensp; [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md)&emsp; 🔗&ensp;[`LeetCode`](https://leetcode.com/problems/find-the-last-marked-nodes-in-tree)
4+
5+
6+
## 题目
7+
8+
9+
10+
11+
## 题目大意
12+
13+
14+
15+
16+
## 解题思路
17+
18+
#### 复杂度分析
19+
20+
- **时间复杂度**`O()`
21+
- **空间复杂度**`O()`
22+
23+
## 代码
24+
25+
```javascript
26+
27+
```
28+
29+
## 相关题目
30+
31+
:::: md-demo 相关题目
32+
- [访问消失节点的最少时间](https://leetcode.com/problems/minimum-time-to-visit-disappearing-nodes)
33+
- [标记所有节点需要的时间](https://leetcode.com/problems/time-taken-to-mark-all-nodes)
34+
35+
::::

assets/scripts/leetcode-crawler.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ def __init__(self, title_slug, *args):
3232
threading.Thread.__init__(self)
3333
self.title_slug = title_slug
3434
self.status = None
35-
if len(args) == 2:
35+
if len(args) == 1:
3636
self.status = args[0]
37-
self.only = args[1]
3837
def run(self):
3938
IS_SUCCESS = False
4039
conn = sqlite3.connect(db_path, timeout=10)
@@ -81,8 +80,6 @@ def run(self):
8180
resp.encoding = 'utf8'
8281
content = resp.json()
8382

84-
if (self.only):
85-
print('------pay only content', content)
8683

8784
contentEN = ''
8885
contentCN = ''
@@ -110,8 +107,6 @@ def run(self):
110107
tags.append(tag_str)
111108

112109

113-
114-
115110
question_detail = (questionId,
116111
content['data']['question']['questionFrontendId'],
117112
content['data']['question']['questionTitle'],
@@ -181,9 +176,7 @@ def get_problems(self, filters):
181176
question_update_list = []
182177
threads = []
183178
cursor = self.conn.cursor()
184-
count = 0
185179
for question in question_list['stat_status_pairs']:
186-
count = count + 1
187180

188181
question_id = question['stat']['question_id']
189182
question_slug = question['stat']['question__title_slug']
@@ -208,15 +201,12 @@ def get_problems(self, filters):
208201
if filters['status'] != question_status:
209202
continue
210203

211-
if question['paid_only']:
212-
print('---------------------paid_only', question_id, question_slug)
213-
# continue
214204

215205
cursor.execute('SELECT status FROM question WHERE id = ?', (question_id,))
216206
result = cursor.fetchone()
217207
if not result:
218208
# 创建新线程
219-
thread = insetQuestionThread(question_slug, question_status, question['paid_only'])
209+
thread = insetQuestionThread(question_slug, question_status)
220210
thread.start()
221211
while True:
222212
#判断正在运行的线程数量,如果小于5则退出while循环,
@@ -228,13 +218,10 @@ def get_problems(self, filters):
228218
threads.append(thread)
229219
elif self.is_login and question_status != result[0]:
230220
question_update_list.append((question_status, question_id))
231-
else:
232-
print('already in db:', question_id, question_slug)
233-
print('-------------', count)
221+
234222

235223
for t in threads:
236224
t.join()
237-
print('-------------end', count)
238225
cursor.executemany('UPDATE question SET status = ? WHERE id = ?', question_update_list)
239226
self.conn.commit()
240227
cursor.close()

assets/scripts/leetcode-problems.csv

Lines changed: 0 additions & 3141 deletions
This file was deleted.

assets/scripts/problem-list.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3699,3 +3699,4 @@ LCP 04,LCP_04,other,Broken Board Dominoes,覆盖,broken-board-dominoes,"Bit Mani
36993699
159,0159,0100-0199,Longest Substring with At Most Two Distinct Characters,至多包含两个不同字符的最长子串,longest-substring-with-at-most-two-distinct-characters,"Hash Table|hash-table|哈希表,String|string|字符串,Sliding Window|sliding-window|滑动窗口",Medium
37003700
157,0157,0100-0199,Read N Characters Given Read4,用 Read4 读取 N 个字符,read-n-characters-given-read4,"Array|array|数组,Interactive|interactive|交互,Simulation|simulation|模拟",Easy
37013701
156,0156,0100-0199,Binary Tree Upside Down,上下翻转二叉树,binary-tree-upside-down,"Tree|tree|树,Depth-First Search|depth-first-search|深度优先搜索,Binary Tree|binary-tree|二叉树",Medium
3702+
3313,3313,3300-3399,Find the Last Marked Nodes in Tree,Find the Last Marked Nodes in Tree,find-the-last-marked-nodes-in-tree,"Tree|tree|树,Depth-First Search|depth-first-search|深度优先搜索",Hard

assets/scripts/utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
from urllib.parse import quote
88
import const
99

10+
# 自定义排序函数:可转换为整数的按数值排序,非数字的按字典顺序排序
11+
def custom_sort(val):
12+
# 尝试将值转换为整数
13+
try:
14+
return (0, int(val)) # 数字部分的优先级高
15+
except ValueError:
16+
return (1, val) # 非数字部分的优先级次之,按字典顺序排序
17+
1018
# 根据 frame 生成 Markdown 表格
1119

1220

@@ -38,7 +46,7 @@ def gen_markdown_table(frame, need_sort):
3846

3947
# 数据部分
4048
if need_sort:
41-
frame = frame.sort_values(by='题号')
49+
frame = frame.sort_values(by='题号', key=lambda col: col.apply(custom_sort))
4250
frame = frame.reset_index(drop=True)
4351
for i in range(H):
4452
problem = "|"
@@ -195,7 +203,7 @@ def getFileName(id, slug):
195203
if str(id).find('面试题') != -1:
196204
return "i_" + id.split('面试题 ')[1]
197205
if len(str(id)) < 5:
198-
return str("{:0>4d}".format(id))
206+
return "{:0>4d}".format(id)
199207
if slug in const.offer_dict:
200208
return const.offer_dict[slug].split(',')[1]
201209
if slug in const.offer2_dict:

src/.vuepress/sidebar.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,13 @@ export default sidebar({
471471
"1813"
472472
],
473473
},
474+
{
475+
text: "1900-1999",
476+
collapsible: true,
477+
children: [
478+
"1963"
479+
],
480+
},
474481
{
475482
text: "2100-2199",
476483
collapsible: true,

0 commit comments

Comments
 (0)