Skip to content

Commit dddd645

Browse files
committed
feat: update summary and solution/readme
1 parent e9039be commit dddd645

File tree

7 files changed

+3683
-3731
lines changed

7 files changed

+3683
-3731
lines changed

.github/workflows/prettier.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Prettier
33
on:
44
push:
55
branches: [main]
6+
paths-ignore:
7+
- 'solution/*.md'
68

79
jobs:
810
prettier:

solution/README.md

+1,828-1,827
Large diffs are not rendered by default.

solution/README_EN.md

+1,828-1,827
Large diffs are not rendered by default.

solution/main.py

+14-30
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ def get_all_questions(self):
100100
continue
101101

102102
frontend_question_id = str(question['stat']['frontend_question_id']).zfill(4)
103-
question_id = str(question['stat']['question_id']).zfill(4)
104103
no = int(frontend_question_id) // 100
105-
paid_only = question['paid_only']
106104

107105
question_title_en = question['stat']['question__title']
108106
question_title_en = re.sub(r'[\\/:*?"<>|]', '', question_title_en).strip()
@@ -114,42 +112,28 @@ def get_all_questions(self):
114112
path_en = f'/solution/{self.sub_folders[no]}/{frontend_question_id}.{quote(question_title_en)}/README_EN.md'
115113

116114
print(frontend_question_id)
117-
115+
topic_tags = question_detail.get('topicTags')
118116
item = {
119-
'question_id': question_id,
117+
'question_id': str(question['stat']['question_id']).zfill(4),
120118
'frontend_question_id': frontend_question_id,
121-
'paid_only': paid_only,
122-
'paid_only_cn': '',
119+
'paid_only': question['paid_only'],
120+
'paid_only_cn': question_detail.get('isPaidOnly'),
123121
'url_cn': url_cn,
124122
'url_en': url_en,
125123
'relative_path_cn': path_cn,
126124
'relative_path_en': path_en,
127-
'title_cn': '',
128-
'title_en': question_title_en,
125+
'title_cn': question_detail.get('translatedTitle') or '',
126+
'title_en': question_title_en or '',
129127
'question_title_slug': question_title_slug,
130-
'content_en': '',
131-
'content_cn': '',
132-
'tags_en': [],
133-
'tags_cn': [],
134-
'difficulty_en': '',
135-
'difficulty_cn': '',
136-
'code_snippets': [],
137-
128+
'content_en': question_detail.get('content'),
129+
'content_cn': question_detail.get('translatedContent'),
130+
'tags_en': [e['name'] for e in topic_tags if e['name']] or [],
131+
'tags_cn': [e['translatedName'] for e in topic_tags if e['translatedName']] or [],
132+
'difficulty_en': question_detail.get('difficulty'),
133+
'difficulty_cn': self.difficulty_mapper.get(question_detail.get('difficulty')),
134+
'code_snippets': question_detail.get('codeSnippets') or [],
138135
}
139136

140-
topic_tags = question_detail.get('topicTags')
141-
tags_cn = [e['translatedName'] for e in topic_tags if e['translatedName']]
142-
tags_en = [e['name'] for e in topic_tags if e['name']]
143-
item['title_cn'] = question_detail.get('translatedTitle')
144-
item['tags_en'] = tags_en
145-
item['tags_cn'] = tags_cn
146-
item['content_en'] = question_detail.get('content')
147-
item['content_cn'] = question_detail.get('translatedContent')
148-
item['difficulty_en'] = question_detail.get('difficulty')
149-
item['difficulty_cn'] = self.difficulty_mapper.get(question_detail.get('difficulty'))
150-
item['code_snippets'] = question_detail.get('codeSnippets')
151-
item['paid_only_cn'] = question_detail.get('isPaidOnly')
152-
153137
col1_cn = f'[{frontend_question_id}]({url_cn})'
154138
col2_cn = f'[{item["title_cn"]}]({path_cn})'
155139
col3_cn = ','.join([f'`{tag}`' for tag in item['tags_cn']])
@@ -161,7 +145,7 @@ def get_all_questions(self):
161145
col3_en = ','.join([f'`{tag}`' for tag in item['tags_en']])
162146
col3_en = '' if (col3_en == 'None' or not col3_en) else col3_en
163147
col4_en = item['difficulty_en']
164-
col5_en = '🔒' if paid_only else ''
148+
col5_en = '🔒' if item['paid_only'] else ''
165149
item['md_table_row_cn'] = [col1_cn, col2_cn, col3_cn, col4_cn, col5_cn]
166150
item['md_table_row_en'] = [col1_en, col2_en, col3_en, col4_en, col5_en]
167151

solution/result.json

+1-1
Large diffs are not rendered by default.

solution/summary.md

+5-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- 0000-0099
21

2+
- 0000-0099
33
- [0001.Two Sum](/solution/0000-0099/0001.Two%20Sum/README.md)
44
- [0002.Add Two Numbers](/solution/0000-0099/0002.Add%20Two%20Numbers/README.md)
55
- [0003.Longest Substring Without Repeating Characters](/solution/0000-0099/0003.Longest%20Substring%20Without%20Repeating%20Characters/README.md)
@@ -101,7 +101,6 @@
101101
- [0099.Recover Binary Search Tree](/solution/0000-0099/0099.Recover%20Binary%20Search%20Tree/README.md)
102102

103103
- 0100-0199
104-
105104
- [0100.Same Tree](/solution/0100-0199/0100.Same%20Tree/README.md)
106105
- [0101.Symmetric Tree](/solution/0100-0199/0101.Symmetric%20Tree/README.md)
107106
- [0102.Binary Tree Level Order Traversal](/solution/0100-0199/0102.Binary%20Tree%20Level%20Order%20Traversal/README.md)
@@ -204,7 +203,6 @@
204203
- [0199.Binary Tree Right Side View](/solution/0100-0199/0199.Binary%20Tree%20Right%20Side%20View/README.md)
205204

206205
- 0200-0299
207-
208206
- [0200.Number of Islands](/solution/0200-0299/0200.Number%20of%20Islands/README.md)
209207
- [0201.Bitwise AND of Numbers Range](/solution/0200-0299/0201.Bitwise%20AND%20of%20Numbers%20Range/README.md)
210208
- [0202.Happy Number](/solution/0200-0299/0202.Happy%20Number/README.md)
@@ -307,7 +305,6 @@
307305
- [0299.Bulls and Cows](/solution/0200-0299/0299.Bulls%20and%20Cows/README.md)
308306

309307
- 0300-0399
310-
311308
- [0300.Longest Increasing Subsequence](/solution/0300-0399/0300.Longest%20Increasing%20Subsequence/README.md)
312309
- [0301.Remove Invalid Parentheses](/solution/0300-0399/0301.Remove%20Invalid%20Parentheses/README.md)
313310
- [0302.Smallest Rectangle Enclosing Black Pixels](/solution/0300-0399/0302.Smallest%20Rectangle%20Enclosing%20Black%20Pixels/README.md)
@@ -410,7 +407,6 @@
410407
- [0399.Evaluate Division](/solution/0300-0399/0399.Evaluate%20Division/README.md)
411408

412409
- 0400-0499
413-
414410
- [0400.Nth Digit](/solution/0400-0499/0400.Nth%20Digit/README.md)
415411
- [0401.Binary Watch](/solution/0400-0499/0401.Binary%20Watch/README.md)
416412
- [0402.Remove K Digits](/solution/0400-0499/0402.Remove%20K%20Digits/README.md)
@@ -513,7 +509,6 @@
513509
- [0499.The Maze III](/solution/0400-0499/0499.The%20Maze%20III/README.md)
514510

515511
- 0500-0599
516-
517512
- [0500.Keyboard Row](/solution/0500-0599/0500.Keyboard%20Row/README.md)
518513
- [0501.Find Mode in Binary Search Tree](/solution/0500-0599/0501.Find%20Mode%20in%20Binary%20Search%20Tree/README.md)
519514
- [0502.IPO](/solution/0500-0599/0502.IPO/README.md)
@@ -611,16 +606,15 @@
611606
- [0594.Longest Harmonious Subsequence](/solution/0500-0599/0594.Longest%20Harmonious%20Subsequence/README.md)
612607
- [0595.Big Countries](/solution/0500-0599/0595.Big%20Countries/README.md)
613608
- [0596.Classes More Than 5 Students](/solution/0500-0599/0596.Classes%20More%20Than%205%20Students/README.md)
614-
- [0597.Friend Requests I Overall Acceptance Rate](/solution/0500-0599/0597.Friend%20Requests%20I%20%20Overall%20Acceptance%20Rate/README.md)
609+
- [0597.Friend Requests I Overall Acceptance Rate](/solution/0500-0599/0597.Friend%20Requests%20I%20%20Overall%20Acceptance%20Rate/README.md)
615610
- [0597.Friend Requests I Overall Acceptance Rate](/solution/0500-0599/0597.Friend%20Requests%20I%20Overall%20Acceptance%20Rate/README.md)
616611
- [0598.Range Addition II](/solution/0500-0599/0598.Range%20Addition%20II/README.md)
617612
- [0599.Minimum Index Sum of Two Lists](/solution/0500-0599/0599.Minimum%20Index%20Sum%20of%20Two%20Lists/README.md)
618613

619614
- 0600-0699
620-
621615
- [0600.Non-negative Integers without Consecutive Ones](/solution/0600-0699/0600.Non-negative%20Integers%20without%20Consecutive%20Ones/README.md)
622616
- [0601.Human Traffic of Stadium](/solution/0600-0699/0601.Human%20Traffic%20of%20Stadium/README.md)
623-
- [0602.Friend Requests II Who Has the Most Friends](/solution/0600-0699/0602.Friend%20Requests%20II%20%20Who%20Has%20the%20Most%20Friends/README.md)
617+
- [0602.Friend Requests II Who Has the Most Friends](/solution/0600-0699/0602.Friend%20Requests%20II%20%20Who%20Has%20the%20Most%20Friends/README.md)
624618
- [0602.Friend Requests II Who Has the Most Friends](/solution/0600-0699/0602.Friend%20Requests%20II%20Who%20Has%20the%20Most%20Friends/README.md)
625619
- [0603.Consecutive Available Seats](/solution/0600-0699/0603.Consecutive%20Available%20Seats/README.md)
626620
- [0604.Design Compressed String Iterator](/solution/0600-0699/0604.Design%20Compressed%20String%20Iterator/README.md)
@@ -634,7 +628,7 @@
634628
- [0612.Shortest Distance in a Plane](/solution/0600-0699/0612.Shortest%20Distance%20in%20a%20Plane/README.md)
635629
- [0613.Shortest Distance in a Line](/solution/0600-0699/0613.Shortest%20Distance%20in%20a%20Line/README.md)
636630
- [0614.Second Degree Follower](/solution/0600-0699/0614.Second%20Degree%20Follower/README.md)
637-
- [0615.Average Salary Departments VS Company](/solution/0600-0699/0615.Average%20Salary%20%20Departments%20VS%20Company/README.md)
631+
- [0615.Average Salary Departments VS Company](/solution/0600-0699/0615.Average%20Salary%20%20Departments%20VS%20Company/README.md)
638632
- [0615.Average Salary Departments VS Company](/solution/0600-0699/0615.Average%20Salary%20Departments%20VS%20Company/README.md)
639633
- [0616.Add Bold Tag in String](/solution/0600-0699/0616.Add%20Bold%20Tag%20in%20String/README.md)
640634
- [0617.Merge Two Binary Trees](/solution/0600-0699/0617.Merge%20Two%20Binary%20Trees/README.md)
@@ -722,7 +716,6 @@
722716
- [0699.Falling Squares](/solution/0600-0699/0699.Falling%20Squares/README.md)
723717

724718
- 0700-0799
725-
726719
- [0700.Search in a Binary Search Tree](/solution/0700-0799/0700.Search%20in%20a%20Binary%20Search%20Tree/README.md)
727720
- [0701.Insert into a Binary Search Tree](/solution/0700-0799/0701.Insert%20into%20a%20Binary%20Search%20Tree/README.md)
728721
- [0702.Search in a Sorted Array of Unknown Size](/solution/0700-0799/0702.Search%20in%20a%20Sorted%20Array%20of%20Unknown%20Size/README.md)
@@ -825,7 +818,6 @@
825818
- [0799.Champagne Tower](/solution/0700-0799/0799.Champagne%20Tower/README.md)
826819

827820
- 0800-0899
828-
829821
- [0800.Similar RGB Color](/solution/0800-0899/0800.Similar%20RGB%20Color/README.md)
830822
- [0801.Minimum Swaps To Make Sequences Increasing](/solution/0800-0899/0801.Minimum%20Swaps%20To%20Make%20Sequences%20Increasing/README.md)
831823
- [0802.Find Eventual Safe States](/solution/0800-0899/0802.Find%20Eventual%20Safe%20States/README.md)
@@ -928,7 +920,6 @@
928920
- [0899.Orderly Queue](/solution/0800-0899/0899.Orderly%20Queue/README.md)
929921

930922
- 0900-0999
931-
932923
- [0900.RLE Iterator](/solution/0900-0999/0900.RLE%20Iterator/README.md)
933924
- [0901.Online Stock Span](/solution/0900-0999/0901.Online%20Stock%20Span/README.md)
934925
- [0902.Numbers At Most N Given Digit Set](/solution/0900-0999/0902.Numbers%20At%20Most%20N%20Given%20Digit%20Set/README.md)
@@ -1031,7 +1022,6 @@
10311022
- [0999.Available Captures for Rook](/solution/0900-0999/0999.Available%20Captures%20for%20Rook/README.md)
10321023

10331024
- 1000-1099
1034-
10351025
- [1000.Minimum Cost to Merge Stones](/solution/1000-1099/1000.Minimum%20Cost%20to%20Merge%20Stones/README.md)
10361026
- [1001.Grid Illumination](/solution/1000-1099/1001.Grid%20Illumination/README.md)
10371027
- [1002.Find Common Characters](/solution/1000-1099/1002.Find%20Common%20Characters/README.md)
@@ -1142,7 +1132,6 @@
11421132
- [1099.Two Sum Less Than K](/solution/1000-1099/1099.Two%20Sum%20Less%20Than%20K/README.md)
11431133

11441134
- 1100-1199
1145-
11461135
- [1100.Find K-Length Substrings With No Repeated Characters](/solution/1100-1199/1100.Find%20K-Length%20Substrings%20With%20No%20Repeated%20Characters/README.md)
11471136
- [1101.The Earliest Moment When Everyone Become Friends](/solution/1100-1199/1101.The%20Earliest%20Moment%20When%20Everyone%20Become%20Friends/README.md)
11481137
- [1102.Path With Maximum Minimum Value](/solution/1100-1199/1102.Path%20With%20Maximum%20Minimum%20Value/README.md)
@@ -1245,7 +1234,6 @@
12451234
- [1199.Minimum Time to Build Blocks](/solution/1100-1199/1199.Minimum%20Time%20to%20Build%20Blocks/README.md)
12461235

12471236
- 1200-1299
1248-
12491237
- [1200.Minimum Absolute Difference](/solution/1200-1299/1200.Minimum%20Absolute%20Difference/README.md)
12501238
- [1201.Ugly Number III](/solution/1200-1299/1201.Ugly%20Number%20III/README.md)
12511239
- [1202.Smallest String With Swaps](/solution/1200-1299/1202.Smallest%20String%20With%20Swaps/README.md)
@@ -1348,7 +1336,6 @@
13481336
- [1299.Replace Elements with Greatest Element on Right Side](/solution/1200-1299/1299.Replace%20Elements%20with%20Greatest%20Element%20on%20Right%20Side/README.md)
13491337

13501338
- 1300-1399
1351-
13521339
- [1300.Sum of Mutated Array Closest to Target](/solution/1300-1399/1300.Sum%20of%20Mutated%20Array%20Closest%20to%20Target/README.md)
13531340
- [1301.Number of Paths with Max Score](/solution/1300-1399/1301.Number%20of%20Paths%20with%20Max%20Score/README.md)
13541341
- [1302.Deepest Leaves Sum](/solution/1300-1399/1302.Deepest%20Leaves%20Sum/README.md)
@@ -1452,7 +1439,6 @@
14521439
- [1399.Count Largest Group](/solution/1300-1399/1399.Count%20Largest%20Group/README.md)
14531440

14541441
- 1400-1499
1455-
14561442
- [1400.Construct K Palindrome Strings](/solution/1400-1499/1400.Construct%20K%20Palindrome%20Strings/README.md)
14571443
- [1401.Circle and Rectangle Overlapping](/solution/1400-1499/1401.Circle%20and%20Rectangle%20Overlapping/README.md)
14581444
- [1402.Reducing Dishes](/solution/1400-1499/1402.Reducing%20Dishes/README.md)
@@ -1555,7 +1541,6 @@
15551541
- [1499.Max Value of Equation](/solution/1400-1499/1499.Max%20Value%20of%20Equation/README.md)
15561542

15571543
- 1500-1599
1558-
15591544
- [1500.Design a File Sharing System](/solution/1500-1599/1500.Design%20a%20File%20Sharing%20System/README.md)
15601545
- [1501.Countries You Can Safely Invest In](/solution/1500-1599/1501.Countries%20You%20Can%20Safely%20Invest%20In/README.md)
15611546
- [1502.Can Make Arithmetic Progression From Sequence](/solution/1500-1599/1502.Can%20Make%20Arithmetic%20Progression%20From%20Sequence/README.md)
@@ -1616,7 +1601,7 @@
16161601
- [1557.Minimum Number of Vertices to Reach All Nodes](/solution/1500-1599/1557.Minimum%20Number%20of%20Vertices%20to%20Reach%20All%20Nodes/README.md)
16171602
- [1558.Minimum Numbers of Function Calls to Make Target Array](/solution/1500-1599/1558.Minimum%20Numbers%20of%20Function%20Calls%20to%20Make%20Target%20Array/README.md)
16181603
- [1559.Detect Cycles in 2D Grid](/solution/1500-1599/1559.Detect%20Cycles%20in%202D%20Grid/README.md)
1619-
- [1560.Most Visited Sector in a Circular Track](/solution/1500-1599/1560.Most%20Visited%20Sector%20in%20%20a%20Circular%20Track/README.md)
1604+
- [1560.Most Visited Sector in a Circular Track](/solution/1500-1599/1560.Most%20Visited%20Sector%20in%20%20a%20Circular%20Track/README.md)
16201605
- [1561.Maximum Number of Coins You Can Get](/solution/1500-1599/1561.Maximum%20Number%20of%20Coins%20You%20Can%20Get/README.md)
16211606
- [1562.Find Latest Group of Size M](/solution/1500-1599/1562.Find%20Latest%20Group%20of%20Size%20M/README.md)
16221607
- [1563.Stone Game V](/solution/1500-1599/1563.Stone%20Game%20V/README.md)
@@ -1658,7 +1643,6 @@
16581643
- [1599.Maximum Profit of Operating a Centennial Wheel](/solution/1500-1599/1599.Maximum%20Profit%20of%20Operating%20a%20Centennial%20Wheel/README.md)
16591644

16601645
- 1600-1600
1661-
16621646
- [1600.Throne Inheritance](/solution/1600-1600/1600.Throne%20Inheritance/README.md)
16631647
- [1601.Maximum Number of Achievable Transfer Requests](/solution/1600-1600/1601.Maximum%20Number%20of%20Achievable%20Transfer%20Requests/README.md)
16641648
- [1603.Design Parking System](/solution/1600-1600/1603.Design%20Parking%20System/README.md)
@@ -1735,7 +1719,6 @@
17351719
- [1697.Checking Existence of Edge Length Limited Paths](/solution/1600-1600/1697.Checking%20Existence%20of%20Edge%20Length%20Limited%20Paths/README.md)
17361720

17371721
- 1600-1699
1738-
17391722
- [1600.Throne Inheritance](/solution/1600-1699/1600.Throne%20Inheritance/README.md)
17401723
- [1601.Maximum Number of Achievable Transfer Requests](/solution/1600-1699/1601.Maximum%20Number%20of%20Achievable%20Transfer%20Requests/README.md)
17411724
- [1602.Find Nearest Right Node in Binary Tree](/solution/1600-1699/1602.Find%20Nearest%20Right%20Node%20in%20Binary%20Tree/README.md)
@@ -1838,7 +1821,6 @@
18381821
- [1699.Number of Calls Between Two Persons](/solution/1600-1699/1699.Number%20of%20Calls%20Between%20Two%20Persons/README.md)
18391822

18401823
- 1700-1799
1841-
18421824
- [1700.Number of Students Unable to Eat Lunch](/solution/1700-1799/1700.Number%20of%20Students%20Unable%20to%20Eat%20Lunch/README.md)
18431825
- [1701.Average Waiting Time](/solution/1700-1799/1701.Average%20Waiting%20Time/README.md)
18441826
- [1702.Maximum Binary String After Change](/solution/1700-1799/1702.Maximum%20Binary%20String%20After%20Change/README.md)

0 commit comments

Comments
 (0)