Skip to content

Commit c9bcaa3

Browse files
author
Shuo
authored
Merge pull request #724 from openset/develop
Update: daily
2 parents cdb45d9 + 7172e7e commit c9bcaa3

File tree

19 files changed

+60
-16
lines changed

19 files changed

+60
-16
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ LeetCode Problems' Solutions
6262

6363
| # | Title | Solution | Difficulty |
6464
| :-: | - | - | :-: |
65+
| <span id="1270">1270</span> | [All People Report to the Given Manager](https://leetcode.com/problems/all-people-report-to-the-given-manager) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/all-people-report-to-the-given-manager) | Medium |
6566
| <span id="1269">1269</span> | [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 "停在原地的方案数") | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps) | Hard |
6667
| <span id="1268">1268</span> | [Search Suggestions System](https://leetcode.com/problems/search-suggestions-system "搜索推荐系统") | [Go](https://github.com/openset/leetcode/tree/master/problems/search-suggestions-system) | Medium |
6768
| <span id="1267">1267</span> | [Count Servers that Communicate](https://leetcode.com/problems/count-servers-that-communicate "统计参与通信的服务器") | [Go](https://github.com/openset/leetcode/tree/master/problems/count-servers-that-communicate) | Medium |

internal/leetcode/question_data.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,25 @@ func (question *questionType) RenamePackageName() {
224224
}
225225
}
226226

227+
func (question *questionType) Restore() {
228+
filename := question.getFilePath("README.md")
229+
body := fileGetContents(filename)
230+
pattern := `## [^\n]+\n\n([\S\s]+)`
231+
if bytes.Contains(body, []byte("\n### ")) {
232+
pattern = `## [^\n]+\n\n([\S\s]+?)\n### `
233+
}
234+
reg := regexp.MustCompile(pattern)
235+
matches := reg.FindSubmatch(body)
236+
if len(matches) >= 2 {
237+
return
238+
}
239+
question.Content = string(matches[1])
240+
name := fmt.Sprintf(questionDataFile, question.TitleSnake())
241+
filePutContents(getCachePath(name), jsonEncode(QuestionDataType{
242+
Data: dataType{Question: *question},
243+
}))
244+
}
245+
227246
func (question *questionType) getSimilarQuestion() []byte {
228247
sq := question.GetSimilarQuestion()
229248
var buf bytes.Buffer
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](https://github.com/openset/leetcode/tree/master/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps "Number of Ways to Stay in the Same Place After Some Steps")
9+
                
10+
Next >
11+
12+
## [1270. All People Report to the Given Manager (Medium)](https://leetcode.com/problems/all-people-report-to-the-given-manager "")
13+
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Create table If Not Exists Employees (employee_id int, employee_name varchar(30), manager_id int);
2+
Truncate table Employees;
3+
insert into Employees (employee_id, employee_name, manager_id) values ('1', 'Boss', '1');
4+
insert into Employees (employee_id, employee_name, manager_id) values ('3', 'Alice', '3');
5+
insert into Employees (employee_id, employee_name, manager_id) values ('2', 'Bob', '1');
6+
insert into Employees (employee_id, employee_name, manager_id) values ('4', 'Daniel', '2');
7+
insert into Employees (employee_id, employee_name, manager_id) values ('7', 'Luis', '4');
8+
insert into Employees (employee_id, employee_name, manager_id) values ('8', 'John', '3');
9+
insert into Employees (employee_id, employee_name, manager_id) values ('9', 'Angela', '8');
10+
insert into Employees (employee_id, employee_name, manager_id) values ('77', 'Robert', '1');

problems/longest-substring-with-at-most-k-distinct-characters/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
### Similar Questions
3939
1. [Longest Substring Without Repeating Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-without-repeating-characters) (Medium)
40-
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Hard)
40+
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Medium)
4141
1. [Longest Repeating Character Replacement](https://github.com/openset/leetcode/tree/master/problems/longest-repeating-character-replacement) (Medium)
4242
1. [Subarrays with K Different Integers](https://github.com/openset/leetcode/tree/master/problems/subarrays-with-k-different-integers) (Hard)
4343
1. [Max Consecutive Ones III](https://github.com/openset/leetcode/tree/master/problems/max-consecutive-ones-iii) (Medium)

problems/longest-substring-with-at-most-two-distinct-characters/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
[Next >](https://github.com/openset/leetcode/tree/master/problems/intersection-of-two-linked-lists "Intersection of Two Linked Lists")
1111

12-
## [159. Longest Substring with At Most Two Distinct Characters (Hard)](https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters "至多包含两个不同字符的最长子串")
12+
## [159. Longest Substring with At Most Two Distinct Characters (Medium)](https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters "至多包含两个不同字符的最长子串")
1313

1414
<p>Given a string <strong><em>s</em></strong> , find the length of the longest substring&nbsp;<strong><em>t&nbsp;&nbsp;</em></strong>that contains <strong>at most </strong>2 distinct characters.</p>
1515

problems/longest-substring-without-repeating-characters/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@
5151
[[Sliding Window](https://github.com/openset/leetcode/tree/master/tag/sliding-window/README.md)]
5252

5353
### Similar Questions
54-
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Hard)
54+
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Medium)
5555
1. [Longest Substring with At Most K Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-k-distinct-characters) (Hard)
5656
1. [Subarrays with K Different Integers](https://github.com/openset/leetcode/tree/master/problems/subarrays-with-k-different-integers) (Hard)

problems/majority-element/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
[Next >](https://github.com/openset/leetcode/tree/master/problems/two-sum-iii-data-structure-design "Two Sum III - Data structure design")
1111

12-
## [169. Majority Element (Easy)](https://leetcode.com/problems/majority-element "求众数")
12+
## [169. Majority Element (Easy)](https://leetcode.com/problems/majority-element "多数元素")
1313

1414
<p>Given an array of size <i>n</i>, find the majority element. The majority element is the element that appears <b>more than</b> <code>&lfloor; n/2 &rfloor;</code> times.</p>
1515

problems/number-of-ways-to-stay-in-the-same-place-after-some-steps/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[< Previous](https://github.com/openset/leetcode/tree/master/problems/search-suggestions-system "Search Suggestions System")
99

10-
Next >
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/all-people-report-to-the-given-manager "All People Report to the Given Manager")
1111

1212
## [1269. Number of Ways to Stay in the Same Place After Some Steps (Hard)](https://leetcode.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps "停在原地的方案数")
1313

problems/sliding-window-maximum/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Could you solve it in linear time?</p>
4343
### Similar Questions
4444
1. [Minimum Window Substring](https://github.com/openset/leetcode/tree/master/problems/minimum-window-substring) (Hard)
4545
1. [Min Stack](https://github.com/openset/leetcode/tree/master/problems/min-stack) (Easy)
46-
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Hard)
46+
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Medium)
4747
1. [Paint House II](https://github.com/openset/leetcode/tree/master/problems/paint-house-ii) (Hard)
4848

4949
### Hints

problems/subarrays-with-k-different-integers/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@
5252

5353
### Similar Questions
5454
1. [Longest Substring Without Repeating Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-without-repeating-characters) (Medium)
55-
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Hard)
55+
1. [Longest Substring with At Most Two Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) (Medium)
5656
1. [Longest Substring with At Most K Distinct Characters](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-k-distinct-characters) (Hard)

readme/1-300.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ LeetCode Problems' Solutions
220220
| <span id="156">156</span> | [Binary Tree Upside Down](https://leetcode.com/problems/binary-tree-upside-down "上下翻转二叉树") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/binary-tree-upside-down) | Medium |
221221
| <span id="157">157</span> | [Read N Characters Given Read4](https://leetcode.com/problems/read-n-characters-given-read4 "用 Read4 读取 N 个字符") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/read-n-characters-given-read4) | Easy |
222222
| <span id="158">158</span> | [Read N Characters Given Read4 II - Call multiple times](https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times "用 Read4 读取 N 个字符 II") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/read-n-characters-given-read4-ii-call-multiple-times) | Hard |
223-
| <span id="159">159</span> | [Longest Substring with At Most Two Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters "至多包含两个不同字符的最长子串") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) | Hard |
223+
| <span id="159">159</span> | [Longest Substring with At Most Two Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters "至多包含两个不同字符的最长子串") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-substring-with-at-most-two-distinct-characters) | Medium |
224224
| <span id="160">160</span> | [Intersection of Two Linked Lists](https://leetcode.com/problems/intersection-of-two-linked-lists "相交链表") | [Go](https://github.com/openset/leetcode/tree/master/problems/intersection-of-two-linked-lists) | Easy |
225225
| <span id="161">161</span> | [One Edit Distance](https://leetcode.com/problems/one-edit-distance "相隔为 1 的编辑距离") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/one-edit-distance) | Medium |
226226
| <span id="162">162</span> | [Find Peak Element](https://leetcode.com/problems/find-peak-element "寻找峰值") | [Go](https://github.com/openset/leetcode/tree/master/problems/find-peak-element) | Medium |
@@ -230,7 +230,7 @@ LeetCode Problems' Solutions
230230
| <span id="166">166</span> | [Fraction to Recurring Decimal](https://leetcode.com/problems/fraction-to-recurring-decimal "分数到小数") | [Go](https://github.com/openset/leetcode/tree/master/problems/fraction-to-recurring-decimal) | Medium |
231231
| <span id="167">167</span> | [Two Sum II - Input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted "两数之和 II - 输入有序数组") | [Go](https://github.com/openset/leetcode/tree/master/problems/two-sum-ii-input-array-is-sorted) | Easy |
232232
| <span id="168">168</span> | [Excel Sheet Column Title](https://leetcode.com/problems/excel-sheet-column-title "Excel表列名称") | [Go](https://github.com/openset/leetcode/tree/master/problems/excel-sheet-column-title) | Easy |
233-
| <span id="169">169</span> | [Majority Element](https://leetcode.com/problems/majority-element "求众数") | [Go](https://github.com/openset/leetcode/tree/master/problems/majority-element) | Easy |
233+
| <span id="169">169</span> | [Majority Element](https://leetcode.com/problems/majority-element "多数元素") | [Go](https://github.com/openset/leetcode/tree/master/problems/majority-element) | Easy |
234234
| <span id="170">170</span> | [Two Sum III - Data structure design](https://leetcode.com/problems/two-sum-iii-data-structure-design "两数之和 III - 数据结构设计") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/two-sum-iii-data-structure-design) | Easy |
235235
| <span id="171">171</span> | [Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number "Excel表列序号") | [Go](https://github.com/openset/leetcode/tree/master/problems/excel-sheet-column-number) | Easy |
236236
| <span id="172">172</span> | [Factorial Trailing Zeroes](https://leetcode.com/problems/factorial-trailing-zeroes "阶乘后的零") | [Go](https://github.com/openset/leetcode/tree/master/problems/factorial-trailing-zeroes) | Easy |

tag/array/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
| 216 | [组合总和 III](https://github.com/openset/leetcode/tree/master/problems/combination-sum-iii) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[回溯算法](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md)] | Medium |
160160
| 209 | [长度最小的子数组](https://github.com/openset/leetcode/tree/master/problems/minimum-size-subarray-sum) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[双指针](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] [[二分查找](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Medium |
161161
| 189 | [旋转数组](https://github.com/openset/leetcode/tree/master/problems/rotate-array) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Easy |
162-
| 169 | [求众数](https://github.com/openset/leetcode/tree/master/problems/majority-element) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[分治算法](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)] | Easy |
162+
| 169 | [多数元素](https://github.com/openset/leetcode/tree/master/problems/majority-element) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[分治算法](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)] | Easy |
163163
| 167 | [两数之和 II - 输入有序数组](https://github.com/openset/leetcode/tree/master/problems/two-sum-ii-input-array-is-sorted) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[双指针](https://github.com/openset/leetcode/tree/master/tag/two-pointers/README.md)] [[二分查找](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Easy |
164164
| 163 | [缺失的区间](https://github.com/openset/leetcode/tree/master/problems/missing-ranges) 🔒 | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] | Medium |
165165
| 162 | [寻找峰值](https://github.com/openset/leetcode/tree/master/problems/find-peak-element) | [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[二分查找](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)] | Medium |

tag/bit-manipulation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
| 191 | [位1的个数](https://github.com/openset/leetcode/tree/master/problems/number-of-1-bits) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] | Easy |
4444
| 190 | [颠倒二进制位](https://github.com/openset/leetcode/tree/master/problems/reverse-bits) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] | Easy |
4545
| 187 | [重复的DNA序列](https://github.com/openset/leetcode/tree/master/problems/repeated-dna-sequences) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[哈希表](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] | Medium |
46-
| 169 | [求众数](https://github.com/openset/leetcode/tree/master/problems/majority-element) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[分治算法](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)] | Easy |
46+
| 169 | [多数元素](https://github.com/openset/leetcode/tree/master/problems/majority-element) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[分治算法](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)] | Easy |
4747
| 137 | [只出现一次的数字 II](https://github.com/openset/leetcode/tree/master/problems/single-number-ii) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] | Medium |
4848
| 136 | [只出现一次的数字](https://github.com/openset/leetcode/tree/master/problems/single-number) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[哈希表](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)] | Easy |
4949
| 78 | [子集](https://github.com/openset/leetcode/tree/master/problems/subsets) | [[位运算](https://github.com/openset/leetcode/tree/master/tag/bit-manipulation/README.md)] [[数组](https://github.com/openset/leetcode/tree/master/tag/array/README.md)] [[回溯算法](https://github.com/openset/leetcode/tree/master/tag/backtracking/README.md)] | Medium |

0 commit comments

Comments
 (0)