Skip to content

Commit 871339f

Browse files
author
Shuo
authored
Merge pull request #755 from openset/develop
Add: new
2 parents 7ecfc2f + 6aab5be commit 871339f

File tree

18 files changed

+318
-14
lines changed

18 files changed

+318
-14
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,16 @@ LeetCode Problems' Solutions
6262

6363
| # | Title | Solution | Difficulty |
6464
| :-: | - | - | :-: |
65+
| <span id="1312">1312</span> | [Minimum Insertion Steps to Make a String Palindrome](https://leetcode.com/problems/minimum-insertion-steps-to-make-a-string-palindrome "让字符串成为回文串的最少插入次数") | [Go](problems/minimum-insertion-steps-to-make-a-string-palindrome) | Hard |
66+
| <span id="1311">1311</span> | [Get Watched Videos by Your Friends](https://leetcode.com/problems/get-watched-videos-by-your-friends "获取你好友已观看的视频") | [Go](problems/get-watched-videos-by-your-friends) | Medium |
67+
| <span id="1310">1310</span> | [XOR Queries of a Subarray](https://leetcode.com/problems/xor-queries-of-a-subarray "子数组异或查询") | [Go](problems/xor-queries-of-a-subarray) | Medium |
68+
| <span id="1309">1309</span> | [Decrypt String from Alphabet to Integer Mapping](https://leetcode.com/problems/decrypt-string-from-alphabet-to-integer-mapping "解码字母到整数映射") | [Go](problems/decrypt-string-from-alphabet-to-integer-mapping) | Easy |
6569
| <span id="1308">1308</span> | [Running Total for Different Genders](https://leetcode.com/problems/running-total-for-different-genders) 🔒 | [MySQL](problems/running-total-for-different-genders) | Medium |
6670
| <span id="1307">1307</span> | [Verbal Arithmetic Puzzle](https://leetcode.com/problems/verbal-arithmetic-puzzle "口算难题") | [Go](problems/verbal-arithmetic-puzzle) | Hard |
6771
| <span id="1306">1306</span> | [Jump Game III](https://leetcode.com/problems/jump-game-iii "跳跃游戏 III") | [Go](problems/jump-game-iii) | Medium |
6872
| <span id="1305">1305</span> | [All Elements in Two Binary Search Trees](https://leetcode.com/problems/all-elements-in-two-binary-search-trees "两棵二叉搜索树中的所有元素") | [Go](problems/all-elements-in-two-binary-search-trees) | Medium |
6973
| <span id="1304">1304</span> | [Find N Unique Integers Sum up to Zero](https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero "和为零的N个唯一整数") | [Go](problems/find-n-unique-integers-sum-up-to-zero) | Easy |
70-
| <span id="1303">1303</span> | [Find the Team Size](https://leetcode.com/problems/find-the-team-size) 🔒 | [MySQL](problems/find-the-team-size) | Easy |
74+
| <span id="1303">1303</span> | [Find the Team Size](https://leetcode.com/problems/find-the-team-size "求团队人数") 🔒 | [MySQL](problems/find-the-team-size) | Easy |
7175
| <span id="1302">1302</span> | [Deepest Leaves Sum](https://leetcode.com/problems/deepest-leaves-sum "层数最深叶子节点的和") | [Go](problems/deepest-leaves-sum) | Medium |
7276
| <span id="1301">1301</span> | [Number of Paths with Max Score](https://leetcode.com/problems/number-of-paths-with-max-score "最大得分的路径数目") | [Go](problems/number-of-paths-with-max-score) | Hard |
7377
| <span id="1300">1300</span> | [Sum of Mutated Array Closest to Target](https://leetcode.com/problems/sum-of-mutated-array-closest-to-target "转变数组后最接近目标值的数组和") | [Go](problems/sum-of-mutated-array-closest-to-target) | Medium |
@@ -100,7 +104,7 @@ LeetCode Problems' Solutions
100104
| <span id="1273">1273</span> | [Delete Tree Nodes](https://leetcode.com/problems/delete-tree-nodes "删除树节点") 🔒 | [Go](problems/delete-tree-nodes) | Medium |
101105
| <span id="1272">1272</span> | [Remove Interval](https://leetcode.com/problems/remove-interval "删除区间") 🔒 | [Go](problems/remove-interval) | Medium |
102106
| <span id="1271">1271</span> | [Hexspeak](https://leetcode.com/problems/hexspeak "十六进制魔术数字") 🔒 | [Go](problems/hexspeak) | Easy |
103-
| <span id="1270">1270</span> | [All People Report to the Given Manager](https://leetcode.com/problems/all-people-report-to-the-given-manager) 🔒 | [MySQL](problems/all-people-report-to-the-given-manager) | Medium |
107+
| <span id="1270">1270</span> | [All People Report to the Given Manager](https://leetcode.com/problems/all-people-report-to-the-given-manager "向公司CEO汇报工作的所有人") 🔒 | [MySQL](problems/all-people-report-to-the-given-manager) | Medium |
104108
| <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](problems/number-of-ways-to-stay-in-the-same-place-after-some-steps) | Hard |
105109
| <span id="1268">1268</span> | [Search Suggestions System](https://leetcode.com/problems/search-suggestions-system "搜索推荐系统") | [Go](problems/search-suggestions-system) | Medium |
106110
| <span id="1267">1267</span> | [Count Servers that Communicate](https://leetcode.com/problems/count-servers-that-communicate "统计参与通信的服务器") | [Go](problems/count-servers-that-communicate) | Medium |
@@ -134,7 +138,7 @@ LeetCode Problems' Solutions
134138
| <span id="1239">1239</span> | [Maximum Length of a Concatenated String with Unique Characters](https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters "串联字符串的最大长度") | [Go](problems/maximum-length-of-a-concatenated-string-with-unique-characters) | Medium |
135139
| <span id="1238">1238</span> | [Circular Permutation in Binary Representation](https://leetcode.com/problems/circular-permutation-in-binary-representation "循环码排列") | [Go](problems/circular-permutation-in-binary-representation) | Medium |
136140
| <span id="1237">1237</span> | [Find Positive Integer Solution for a Given Equation](https://leetcode.com/problems/find-positive-integer-solution-for-a-given-equation "找出给定方程的正整数解") | [Go](problems/find-positive-integer-solution-for-a-given-equation) | Easy |
137-
| <span id="1236">1236</span> | [Web Crawler](https://leetcode.com/problems/web-crawler) 🔒 | [Go](problems/web-crawler) | Medium |
141+
| <span id="1236">1236</span> | [Web Crawler](https://leetcode.com/problems/web-crawler "网络爬虫") 🔒 | [Go](problems/web-crawler) | Medium |
138142
| <span id="1235">1235</span> | [Maximum Profit in Job Scheduling](https://leetcode.com/problems/maximum-profit-in-job-scheduling "规划兼职工作") | [Go](problems/maximum-profit-in-job-scheduling) | Hard |
139143
| <span id="1234">1234</span> | [Replace the Substring for Balanced String](https://leetcode.com/problems/replace-the-substring-for-balanced-string "替换子串得到平衡字符串") | [Go](problems/replace-the-substring-for-balanced-string) | Medium |
140144
| <span id="1233">1233</span> | [Remove Sub-Folders from the Filesystem](https://leetcode.com/problems/remove-sub-folders-from-the-filesystem "删除子文件夹") | [Go](problems/remove-sub-folders-from-the-filesystem) | Medium |
@@ -229,7 +233,7 @@ LeetCode Problems' Solutions
229233
| <span id="1144">1144</span> | [Decrease Elements To Make Array Zigzag](https://leetcode.com/problems/decrease-elements-to-make-array-zigzag "递减元素使数组呈锯齿状") | [Go](problems/decrease-elements-to-make-array-zigzag) | Medium |
230234
| <span id="1143">1143</span> | [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence "最长公共子序列") | [Go](problems/longest-common-subsequence) | Medium |
231235
| <span id="1142">1142</span> | [User Activity for the Past 30 Days II](https://leetcode.com/problems/user-activity-for-the-past-30-days-ii "过去30天的用户活动 II") 🔒 | [MySQL](problems/user-activity-for-the-past-30-days-ii) | Easy |
232-
| <span id="1141">1141</span> | [User Activity for the Past 30 Days I](https://leetcode.com/problems/user-activity-for-the-past-30-days-i) 🔒 | [MySQL](problems/user-activity-for-the-past-30-days-i) | Easy |
236+
| <span id="1141">1141</span> | [User Activity for the Past 30 Days I](https://leetcode.com/problems/user-activity-for-the-past-30-days-i "查询近30天活跃用户数") 🔒 | [MySQL](problems/user-activity-for-the-past-30-days-i) | Easy |
233237
| <span id="1140">1140</span> | [Stone Game II](https://leetcode.com/problems/stone-game-ii "石子游戏 II") | [Go](problems/stone-game-ii) | Medium |
234238
| <span id="1139">1139</span> | [Largest 1-Bordered Square](https://leetcode.com/problems/largest-1-bordered-square "最大的以 1 为边界的正方形") | [Go](problems/largest-1-bordered-square) | Medium |
235239
| <span id="1138">1138</span> | [Alphabet Board Path](https://leetcode.com/problems/alphabet-board-path "字母板上的路径") | [Go](problems/alphabet-board-path) | Medium |
@@ -244,7 +248,7 @@ LeetCode Problems' Solutions
244248
| <span id="1129">1129</span> | [Shortest Path with Alternating Colors](https://leetcode.com/problems/shortest-path-with-alternating-colors "颜色交替的最短路径") | [Go](problems/shortest-path-with-alternating-colors) | Medium |
245249
| <span id="1128">1128</span> | [Number of Equivalent Domino Pairs](https://leetcode.com/problems/number-of-equivalent-domino-pairs "等价多米诺骨牌对的数量") | [Go](problems/number-of-equivalent-domino-pairs) | Easy |
246250
| <span id="1127">1127</span> | [User Purchase Platform](https://leetcode.com/problems/user-purchase-platform) 🔒 | [MySQL](problems/user-purchase-platform) | Hard |
247-
| <span id="1126">1126</span> | [Active Businesses](https://leetcode.com/problems/active-businesses) 🔒 | [MySQL](problems/active-businesses) | Medium |
251+
| <span id="1126">1126</span> | [Active Businesses](https://leetcode.com/problems/active-businesses "查询活跃业务") 🔒 | [MySQL](problems/active-businesses) | Medium |
248252
| <span id="1125">1125</span> | [Smallest Sufficient Team](https://leetcode.com/problems/smallest-sufficient-team "最小的必要团队") | [Go](problems/smallest-sufficient-team) | Hard |
249253
| <span id="1124">1124</span> | [Longest Well-Performing Interval](https://leetcode.com/problems/longest-well-performing-interval "表现良好的最长时间段") | [Go](problems/longest-well-performing-interval) | Medium |
250254
| <span id="1123">1123</span> | [Lowest Common Ancestor of Deepest Leaves](https://leetcode.com/problems/lowest-common-ancestor-of-deepest-leaves "最深叶节点的最近公共祖先") | [Go](problems/lowest-common-ancestor-of-deepest-leaves) | Medium |

problems/active-businesses/README.md

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

1010
[Next >](../user-purchase-platform "User Purchase Platform")
1111

12-
## [1126. Active Businesses (Medium)](https://leetcode.com/problems/active-businesses "")
12+
## [1126. Active Businesses (Medium)](https://leetcode.com/problems/active-businesses "查询活跃业务")
1313

1414
<p>Table: <code>Events</code></p>
1515

problems/all-people-report-to-the-given-manager/README.md

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

1010
[Next >](../hexspeak "Hexspeak")
1111

12-
## [1270. All People Report to the Given Manager (Medium)](https://leetcode.com/problems/all-people-report-to-the-given-manager "")
12+
## [1270. All People Report to the Given Manager (Medium)](https://leetcode.com/problems/all-people-report-to-the-given-manager "向公司CEO汇报工作的所有人")
1313

1414
<p>Table: <code>Employees</code></p>
1515
<pre>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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](../running-total-for-different-genders "Running Total for Different Genders")
9+
                
10+
[Next >](../xor-queries-of-a-subarray "XOR Queries of a Subarray")
11+
12+
## [1309. Decrypt String from Alphabet to Integer Mapping (Easy)](https://leetcode.com/problems/decrypt-string-from-alphabet-to-integer-mapping "解码字母到整数映射")
13+
14+
<p>Given a string <code>s</code> formed by digits (<code>&#39;0&#39;</code> - <code>&#39;9&#39;</code>)&nbsp;and <code>&#39;#&#39;</code>&nbsp;.&nbsp;We want to map <code>s</code> to English lowercase characters as follows:</p>
15+
16+
<ul>
17+
<li>Characters (<code>&#39;a&#39;</code> to <code>&#39;i&#39;)</code> are&nbsp;represented by&nbsp;(<code>&#39;1&#39;</code> to&nbsp;<code>&#39;9&#39;</code>)&nbsp;respectively.</li>
18+
<li>Characters (<code>&#39;j&#39;</code> to <code>&#39;z&#39;)</code> are represented by (<code>&#39;10#&#39;</code>&nbsp;to&nbsp;<code>&#39;26#&#39;</code>)&nbsp;respectively.&nbsp;</li>
19+
</ul>
20+
21+
<p>Return the string formed after mapping.</p>
22+
23+
<p>It&#39;s guaranteed that a unique mapping will always exist.</p>
24+
25+
<p>&nbsp;</p>
26+
<p><strong>Example 1:</strong></p>
27+
28+
<pre>
29+
<strong>Input:</strong> s = &quot;10#11#12&quot;
30+
<strong>Output:</strong> &quot;jkab&quot;
31+
<strong>Explanation:</strong> &quot;j&quot; -&gt; &quot;10#&quot; , &quot;k&quot; -&gt; &quot;11#&quot; , &quot;a&quot; -&gt; &quot;1&quot; , &quot;b&quot; -&gt; &quot;2&quot;.
32+
</pre>
33+
34+
<p><strong>Example 2:</strong></p>
35+
36+
<pre>
37+
<strong>Input:</strong> s = &quot;1326#&quot;
38+
<strong>Output:</strong> &quot;acz&quot;
39+
</pre>
40+
41+
<p><strong>Example 3:</strong></p>
42+
43+
<pre>
44+
<strong>Input:</strong> s = &quot;25#&quot;
45+
<strong>Output:</strong> &quot;y&quot;
46+
</pre>
47+
48+
<p><strong>Example 4:</strong></p>
49+
50+
<pre>
51+
<strong>Input:</strong> s = &quot;12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#&quot;
52+
<strong>Output:</strong> &quot;abcdefghijklmnopqrstuvwxyz&quot;
53+
</pre>
54+
55+
<p>&nbsp;</p>
56+
<p><strong>Constraints:</strong></p>
57+
58+
<ul>
59+
<li><code>1 &lt;= s.length &lt;= 1000</code></li>
60+
<li><code>s[i]</code> only contains digits letters (<code>&#39;0&#39;</code>-<code>&#39;9&#39;</code>) and <code>&#39;#&#39;</code>&nbsp;letter.</li>
61+
<li><code>s</code> will be valid string&nbsp;such that mapping is always possible.</li>
62+
</ul>
63+
64+
### Related Topics
65+
[[String](../../tag/string/README.md)]
66+
67+
### Hints
68+
<details>
69+
<summary>Hint 1</summary>
70+
Scan from right to left, in each step of the scanning check whether there is a trailing "#" 2 indexes away.
71+
</details>

problems/find-the-team-size/README.md

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

1010
[Next >](../find-n-unique-integers-sum-up-to-zero "Find N Unique Integers Sum up to Zero")
1111

12-
## [1303. Find the Team Size (Easy)](https://leetcode.com/problems/find-the-team-size "")
12+
## [1303. Find the Team Size (Easy)](https://leetcode.com/problems/find-the-team-size "求团队人数")
1313

1414

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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](../xor-queries-of-a-subarray "XOR Queries of a Subarray")
9+
                
10+
[Next >](../minimum-insertion-steps-to-make-a-string-palindrome "Minimum Insertion Steps to Make a String Palindrome")
11+
12+
## [1311. Get Watched Videos by Your Friends (Medium)](https://leetcode.com/problems/get-watched-videos-by-your-friends "获取你好友已观看的视频")
13+
14+
<p>There are <code>n</code> people, each person has a unique <em>id</em> between <code>0</code> and <code>n-1</code>. Given the arrays <code>watchedVideos</code> and <code>friends</code>, where <code>watchedVideos[i]</code> and <code>friends[i]</code> contain the list of watched videos and the list of friends respectively for the person with <code>id = i</code>.</p>
15+
16+
<p>Level <strong>1</strong> of videos are all watched videos by your&nbsp;friends, level <strong>2</strong> of videos are all watched videos by the friends of your&nbsp;friends and so on. In general, the level <strong>k</strong> of videos are all&nbsp;watched videos by people&nbsp;with the shortest path&nbsp;equal&nbsp;to&nbsp;<strong>k</strong> with you. Given your&nbsp;<code>id</code> and the <code>level</code> of videos, return the list of videos ordered by their frequencies (increasing). For videos with the same frequency order them alphabetically from least to greatest.&nbsp;</p>
17+
18+
<p>&nbsp;</p>
19+
<p><strong>Example 1:</strong></p>
20+
21+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/01/02/leetcode_friends_1.png" style="width: 144px; height: 200px;" /></strong></p>
22+
23+
<pre>
24+
<strong>Input:</strong> watchedVideos = [[&quot;A&quot;,&quot;B&quot;],[&quot;C&quot;],[&quot;B&quot;,&quot;C&quot;],[&quot;D&quot;]], friends = [[1,2],[0,3],[0,3],[1,2]], id = 0, level = 1
25+
<strong>Output:</strong> [&quot;B&quot;,&quot;C&quot;]
26+
<strong>Explanation:</strong>
27+
You have id = 0 (green color in the figure) and your friends are (yellow color in the figure):
28+
Person with id = 1 -&gt; watchedVideos = [&quot;C&quot;]&nbsp;
29+
Person with id = 2 -&gt; watchedVideos = [&quot;B&quot;,&quot;C&quot;]&nbsp;
30+
The frequencies of watchedVideos by your friends are:&nbsp;
31+
B -&gt; 1&nbsp;
32+
C -&gt; 2
33+
</pre>
34+
35+
<p><strong>Example 2:</strong></p>
36+
37+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/01/02/leetcode_friends_2.png" style="width: 144px; height: 200px;" /></strong></p>
38+
39+
<pre>
40+
<strong>Input:</strong> watchedVideos = [[&quot;A&quot;,&quot;B&quot;],[&quot;C&quot;],[&quot;B&quot;,&quot;C&quot;],[&quot;D&quot;]], friends = [[1,2],[0,3],[0,3],[1,2]], id = 0, level = 2
41+
<strong>Output:</strong> [&quot;D&quot;]
42+
<strong>Explanation:</strong>
43+
You have id = 0 (green color in the figure) and the only friend of your friends is the person with id = 3 (yellow color in the figure).
44+
</pre>
45+
46+
<p>&nbsp;</p>
47+
<p><strong>Constraints:</strong></p>
48+
49+
<ul>
50+
<li><code>n == watchedVideos.length ==&nbsp;friends.length</code></li>
51+
<li><code>2 &lt;= n&nbsp;&lt;= 100</code></li>
52+
<li><code>1 &lt;=&nbsp;watchedVideos[i].length &lt;= 100</code></li>
53+
<li><code>1 &lt;=&nbsp;watchedVideos[i][j].length &lt;= 8</code></li>
54+
<li><code>0 &lt;= friends[i].length &lt; n</code></li>
55+
<li><code>0 &lt;= friends[i][j]&nbsp;&lt; n</code></li>
56+
<li><code>0 &lt;= id &lt; n</code></li>
57+
<li><code>1 &lt;= level &lt; n</code></li>
58+
<li>if&nbsp;<code>friends[i]</code> contains <code>j</code>, then <code>friends[j]</code> contains <code>i</code></li>
59+
</ul>
60+
61+
### Related Topics
62+
[[Breadth-first Search](../../tag/breadth-first-search/README.md)]
63+
[[Hash Table](../../tag/hash-table/README.md)]
64+
[[String](../../tag/string/README.md)]
65+
66+
### Hints
67+
<details>
68+
<summary>Hint 1</summary>
69+
Do BFS to find the kth level friends.
70+
</details>
71+
72+
<details>
73+
<summary>Hint 2</summary>
74+
Then collect movies saw by kth level friends and sort them accordingly.
75+
</details>

0 commit comments

Comments
 (0)