Skip to content

Commit 6d11c3a

Browse files
author
Shuo
committed
Add: new
1 parent 6117b66 commit 6d11c3a

File tree

25 files changed

+683
-51
lines changed

25 files changed

+683
-51
lines changed

README.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,20 @@ LeetCode Problems' Solutions
6262

6363
| # | Title | Solution | Difficulty |
6464
| :-: | - | - | :-: |
65+
| <span id="1349">1349</span> | [Maximum Students Taking Exam](https://leetcode.com/problems/maximum-students-taking-exam "参加考试的最大学生数") | [Go](problems/maximum-students-taking-exam) | Hard |
66+
| <span id="1348">1348</span> | [Tweet Counts Per Frequency](https://leetcode.com/problems/tweet-counts-per-frequency "推文计数") | [Go](problems/tweet-counts-per-frequency) | Medium |
67+
| <span id="1347">1347</span> | [Minimum Number of Steps to Make Two Strings Anagram](https://leetcode.com/problems/minimum-number-of-steps-to-make-two-strings-anagram "制造字母异位词的最小步骤数") | [Go](problems/minimum-number-of-steps-to-make-two-strings-anagram) | Medium |
68+
| <span id="1346">1346</span> | [Check If N and Its Double Exist](https://leetcode.com/problems/check-if-n-and-its-double-exist "检查整数及其两倍数是否存在") | [Go](problems/check-if-n-and-its-double-exist) | Easy |
69+
| <span id="1345">1345</span> | [Jump Game IV](https://leetcode.com/problems/jump-game-iv "跳跃游戏 IV") | [Go](problems/jump-game-iv) | Hard |
70+
| <span id="1344">1344</span> | [Angle Between Hands of a Clock](https://leetcode.com/problems/angle-between-hands-of-a-clock "时钟指针的夹角") | [Go](problems/angle-between-hands-of-a-clock) | Medium |
71+
| <span id="1343">1343</span> | [Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold](https://leetcode.com/problems/number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold "大小为 K 且平均值大于等于阈值的子数组数目") | [Go](problems/number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold) | Medium |
72+
| <span id="1342">1342</span> | [Number of Steps to Reduce a Number to Zero](https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero "将数字变成 0 的操作次数") | [Go](problems/number-of-steps-to-reduce-a-number-to-zero) | Easy |
73+
| <span id="1341">1341</span> | [Movie Rating](https://leetcode.com/problems/movie-rating "电影评分") 🔒 | [MySQL](problems/movie-rating) | Medium |
6574
| <span id="1340">1340</span> | [Jump Game V](https://leetcode.com/problems/jump-game-v "跳跃游戏 V") | [Go](problems/jump-game-v) | Hard |
6675
| <span id="1339">1339</span> | [Maximum Product of Splitted Binary Tree](https://leetcode.com/problems/maximum-product-of-splitted-binary-tree "分裂二叉树的最大乘积") | [Go](problems/maximum-product-of-splitted-binary-tree) | Medium |
6776
| <span id="1338">1338</span> | [Reduce Array Size to The Half](https://leetcode.com/problems/reduce-array-size-to-the-half "数组大小减半") | [Go](problems/reduce-array-size-to-the-half) | Medium |
6877
| <span id="1337">1337</span> | [The K Weakest Rows in a Matrix](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix "方阵中战斗力最弱的 K 行") | [Go](problems/the-k-weakest-rows-in-a-matrix) | Easy |
69-
| <span id="1336">1336</span> | [Number of Transactions per Visit](https://leetcode.com/problems/number-of-transactions-per-visit) 🔒 | [MySQL](problems/number-of-transactions-per-visit) | Medium |
78+
| <span id="1336">1336</span> | [Number of Transactions per Visit](https://leetcode.com/problems/number-of-transactions-per-visit) 🔒 | [MySQL](problems/number-of-transactions-per-visit) | Hard |
7079
| <span id="1335">1335</span> | [Minimum Difficulty of a Job Schedule](https://leetcode.com/problems/minimum-difficulty-of-a-job-schedule "工作计划的最低难度") | [Go](problems/minimum-difficulty-of-a-job-schedule) | Hard |
7180
| <span id="1334">1334</span> | [Find the City With the Smallest Number of Neighbors at a Threshold Distance](https://leetcode.com/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance "阈值距离内邻居最少的城市") | [Go](problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance) | Medium |
7281
| <span id="1333">1333</span> | [Filter Restaurants by Vegan-Friendly, Price and Distance](https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance "餐厅过滤器") | [Go](problems/filter-restaurants-by-vegan-friendly-price-and-distance) | Medium |
@@ -191,14 +200,14 @@ LeetCode Problems' Solutions
191200
| <span id="1214">1214</span> | [Two Sum BSTs](https://leetcode.com/problems/two-sum-bsts "查找两棵二叉搜索树之和") 🔒 | [Go](problems/two-sum-bsts) | Medium |
192201
| <span id="1213">1213</span> | [Intersection of Three Sorted Arrays](https://leetcode.com/problems/intersection-of-three-sorted-arrays "三个有序数组的交集") 🔒 | [Go](problems/intersection-of-three-sorted-arrays) | Easy |
193202
| <span id="1212">1212</span> | [Team Scores in Football Tournament](https://leetcode.com/problems/team-scores-in-football-tournament "查询球队积分") 🔒 | [MySQL](problems/team-scores-in-football-tournament) | Medium |
194-
| <span id="1211">1211</span> | [Queries Quality and Percentage](https://leetcode.com/problems/queries-quality-and-percentage) 🔒 | [MySQL](problems/queries-quality-and-percentage) | Easy |
203+
| <span id="1211">1211</span> | [Queries Quality and Percentage](https://leetcode.com/problems/queries-quality-and-percentage "查询结果的质量和占比") 🔒 | [MySQL](problems/queries-quality-and-percentage) | Easy |
195204
| <span id="1210">1210</span> | [Minimum Moves to Reach Target with Rotations](https://leetcode.com/problems/minimum-moves-to-reach-target-with-rotations "穿过迷宫的最少移动次数") | [Go](problems/minimum-moves-to-reach-target-with-rotations) | Hard |
196205
| <span id="1209">1209</span> | [Remove All Adjacent Duplicates in String II](https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii "删除字符串中的所有相邻重复项 II") | [Go](problems/remove-all-adjacent-duplicates-in-string-ii) | Medium |
197206
| <span id="1208">1208</span> | [Get Equal Substrings Within Budget](https://leetcode.com/problems/get-equal-substrings-within-budget "尽可能使字符串相等") | [Go](problems/get-equal-substrings-within-budget) | Medium |
198207
| <span id="1207">1207</span> | [Unique Number of Occurrences](https://leetcode.com/problems/unique-number-of-occurrences "独一无二的出现次数") | [Go](problems/unique-number-of-occurrences) | Easy |
199208
| <span id="1206">1206</span> | [Design Skiplist](https://leetcode.com/problems/design-skiplist "设计跳表") | [Go](problems/design-skiplist) | Hard |
200209
| <span id="1205">1205</span> | [Monthly Transactions II](https://leetcode.com/problems/monthly-transactions-ii "每月交易II") 🔒 | [MySQL](problems/monthly-transactions-ii) | Medium |
201-
| <span id="1204">1204</span> | [Last Person to Fit in the Elevator](https://leetcode.com/problems/last-person-to-fit-in-the-elevator) 🔒 | [MySQL](problems/last-person-to-fit-in-the-elevator) | Medium |
210+
| <span id="1204">1204</span> | [Last Person to Fit in the Elevator](https://leetcode.com/problems/last-person-to-fit-in-the-elevator "最后一个能进入电梯的人") 🔒 | [MySQL](problems/last-person-to-fit-in-the-elevator) | Medium |
202211
| <span id="1203">1203</span> | [Sort Items by Groups Respecting Dependencies](https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies "项目管理") | [Go](problems/sort-items-by-groups-respecting-dependencies) | Hard |
203212
| <span id="1202">1202</span> | [Smallest String With Swaps](https://leetcode.com/problems/smallest-string-with-swaps "交换字符串中的元素") | [Go](problems/smallest-string-with-swaps) | Medium |
204213
| <span id="1201">1201</span> | [Ugly Number III](https://leetcode.com/problems/ugly-number-iii "丑数 III") | [Go](problems/ugly-number-iii) | Medium |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <[email protected]> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold "Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold")
9+
                
10+
[Next >](../jump-game-iv "Jump Game IV")
11+
12+
## [1344. Angle Between Hands of a Clock (Medium)](https://leetcode.com/problems/angle-between-hands-of-a-clock "时钟指针的夹角")
13+
14+
<p>Given two numbers, <code>hour</code> and <code>minutes</code>. Return the smaller angle (in sexagesimal units) formed between the <code>hour</code> and the <code>minute</code> hand.</p>
15+
16+
<p>&nbsp;</p>
17+
<p><strong>Example 1:</strong></p>
18+
19+
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/12/26/sample_1_1673.png" style="width: 230px; height: 225px;" /></p>
20+
21+
<pre>
22+
<strong>Input:</strong> hour = 12, minutes = 30
23+
<strong>Output:</strong> 165
24+
</pre>
25+
26+
<p><strong>Example 2:</strong></p>
27+
28+
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/12/26/sample_2_1673.png" style="width: 230px; height: 225px;" /></p>
29+
30+
<pre>
31+
<strong>Input:</strong> hour = 3, minutes = 30
32+
<strong>Output:</strong> 75
33+
</pre>
34+
35+
<p><strong>Example 3:</strong></p>
36+
37+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2019/12/26/sample_3_1673.png" style="width: 230px; height: 225px;" /></strong></p>
38+
39+
<pre>
40+
<strong>Input:</strong> hour = 3, minutes = 15
41+
<strong>Output:</strong> 7.5
42+
</pre>
43+
44+
<p><strong>Example 4:</strong></p>
45+
46+
<pre>
47+
<strong>Input:</strong> hour = 4, minutes = 50
48+
<strong>Output:</strong> 155
49+
</pre>
50+
51+
<p><strong>Example 5:</strong></p>
52+
53+
<pre>
54+
<strong>Input:</strong> hour = 12, minutes = 0
55+
<strong>Output:</strong> 0
56+
</pre>
57+
58+
<p>&nbsp;</p>
59+
<p><strong>Constraints:</strong></p>
60+
61+
<ul>
62+
<li><code>1 &lt;= hour &lt;= 12</code></li>
63+
<li><code>0 &lt;= minutes &lt;= 59</code></li>
64+
<li>Answers within&nbsp;<code>10^-5</code>&nbsp;of the actual value will be accepted as correct.</li>
65+
</ul>
66+
67+
### Related Topics
68+
[[Math](../../tag/math/README.md)]
69+
70+
### Hints
71+
<details>
72+
<summary>Hint 1</summary>
73+
The tricky part is determining how the minute hand affects the position of the hour hand.
74+
</details>
75+
76+
<details>
77+
<summary>Hint 2</summary>
78+
Calculate the angles separately then find the difference.
79+
</details>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <[email protected]> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../jump-game-iv "Jump Game IV")
9+
                
10+
[Next >](../minimum-number-of-steps-to-make-two-strings-anagram "Minimum Number of Steps to Make Two Strings Anagram")
11+
12+
## [1346. Check If N and Its Double Exist (Easy)](https://leetcode.com/problems/check-if-n-and-its-double-exist "检查整数及其两倍数是否存在")
13+
14+
<p>Given an array <code>arr</code> of integers, check if there exists two integers <code>N</code> and <code>M</code> such that <code>N</code> is the double of <code>M</code> ( i.e. <code>N = 2 * M</code>).</p>
15+
16+
<p>More formally check if there exists&nbsp;two indices <code>i</code> and <code>j</code> such that :</p>
17+
18+
<ul>
19+
<li><code>i != j</code></li>
20+
<li><code>0 &lt;= i, j &lt; arr.length</code></li>
21+
<li><code>arr[i] == 2 * arr[j]</code></li>
22+
</ul>
23+
24+
<p>&nbsp;</p>
25+
<p><strong>Example 1:</strong></p>
26+
27+
<pre>
28+
<strong>Input:</strong> arr = [10,2,5,3]
29+
<strong>Output:</strong> true
30+
<strong>Explanation:</strong> N<code> = 10</code> is the double of M<code> = 5</code>,that is, <code>10 = 2 * 5</code>.
31+
</pre>
32+
33+
<p><strong>Example 2:</strong></p>
34+
35+
<pre>
36+
<strong>Input:</strong> arr = [7,1,14,11]
37+
<strong>Output:</strong> true
38+
<strong>Explanation:</strong> N<code> = 14</code> is the double of M<code> = 7</code>,that is, <code>14 = 2 * 7</code>.
39+
</pre>
40+
41+
<p><strong>Example 3:</strong></p>
42+
43+
<pre>
44+
<strong>Input:</strong> arr = [3,1,7,11]
45+
<strong>Output:</strong> false
46+
<strong>Explanation:</strong> In this case does not exist N and M, such that N = 2 * M.
47+
</pre>
48+
49+
<p>&nbsp;</p>
50+
<p><strong>Constraints:</strong></p>
51+
52+
<ul>
53+
<li><code>2 &lt;= arr.length &lt;= 500</code></li>
54+
<li><code>-10^3 &lt;= arr[i] &lt;= 10^3</code></li>
55+
</ul>
56+
57+
### Related Topics
58+
[[Array](../../tag/array/README.md)]
59+
60+
### Hints
61+
<details>
62+
<summary>Hint 1</summary>
63+
Loop from i = 0 to arr.length, maintaining in a hashTable the array elements from [0, i - 1].
64+
</details>
65+
66+
<details>
67+
<summary>Hint 2</summary>
68+
On each step of the loop check if we have seen the element 2 * arr[i] so far or arr[i] / 2 was seen if arr[i] % 2 == 0.
69+
</details>

problems/counting-bits/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
</ul>
3636

3737
### Related Topics
38-
[[Bit Manipulation](../../tag/bit-manipulation/README.md)]
3938
[[Dynamic Programming](../../tag/dynamic-programming/README.md)]
39+
[[Bit Manipulation](../../tag/bit-manipulation/README.md)]
4040

4141
### Similar Questions
4242
1. [Number of 1 Bits](../number-of-1-bits) (Easy)

problems/intersection-of-two-arrays/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
<p>&nbsp;</p>
3939

4040
### Related Topics
41-
[[Sort](../../tag/sort/README.md)]
4241
[[Hash Table](../../tag/hash-table/README.md)]
4342
[[Two Pointers](../../tag/two-pointers/README.md)]
4443
[[Binary Search](../../tag/binary-search/README.md)]
44+
[[Sort](../../tag/sort/README.md)]
4545

4646
### Similar Questions
4747
1. [Intersection of Two Arrays II](../intersection-of-two-arrays-ii) (Easy)

problems/jump-game-iv/README.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <[email protected]> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../angle-between-hands-of-a-clock "Angle Between Hands of a Clock")
9+
                
10+
[Next >](../check-if-n-and-its-double-exist "Check If N and Its Double Exist")
11+
12+
## [1345. Jump Game IV (Hard)](https://leetcode.com/problems/jump-game-iv "跳跃游戏 IV")
13+
14+
<p>Given an array of&nbsp;integers <code>arr</code>, you are initially positioned at the first index of the array.</p>
15+
16+
<p>In one step you can jump from index <code>i</code> to index:</p>
17+
18+
<ul>
19+
<li><code>i + 1</code> where:&nbsp;<code>i + 1 &lt; arr.length</code>.</li>
20+
<li><code>i - 1</code> where:&nbsp;<code>i - 1 &gt;= 0</code>.</li>
21+
<li><code>j</code> where: <code>arr[i] == arr[j]</code> and <code>i != j</code>.</li>
22+
</ul>
23+
24+
<p>Return <em>the minimum number of steps</em> to reach the <strong>last index</strong> of the array.</p>
25+
26+
<p>Notice that you can not jump outside of the array at any time.</p>
27+
28+
<p>&nbsp;</p>
29+
<p><strong>Example 1:</strong></p>
30+
31+
<pre>
32+
<strong>Input:</strong> arr = [100,-23,-23,404,100,23,23,23,3,404]
33+
<strong>Output:</strong> 3
34+
<strong>Explanation:</strong> You need three jumps from index 0 --&gt; 4 --&gt; 3 --&gt; 9. Note that index 9 is the last index of the array.
35+
</pre>
36+
37+
<p><strong>Example 2:</strong></p>
38+
39+
<pre>
40+
<strong>Input:</strong> arr = [7]
41+
<strong>Output:</strong> 0
42+
<strong>Explanation:</strong> Start index is the last index. You don&#39;t need to jump.
43+
</pre>
44+
45+
<p><strong>Example 3:</strong></p>
46+
47+
<pre>
48+
<strong>Input:</strong> arr = [7,6,9,6,9,6,9,7]
49+
<strong>Output:</strong> 1
50+
<strong>Explanation:</strong> You can jump directly from index 0 to index 7 which is last index of the array.
51+
</pre>
52+
53+
<p><strong>Example 4:</strong></p>
54+
55+
<pre>
56+
<strong>Input:</strong> arr = [6,1,9]
57+
<strong>Output:</strong> 2
58+
</pre>
59+
60+
<p><strong>Example 5:</strong></p>
61+
62+
<pre>
63+
<strong>Input:</strong> arr = [11,22,7,7,7,7,7,7,7,22,13]
64+
<strong>Output:</strong> 3
65+
</pre>
66+
67+
<p>&nbsp;</p>
68+
<p><strong>Constraints:</strong></p>
69+
70+
<ul>
71+
<li><code>1 &lt;= arr.length &lt;= 5 * 10^4</code></li>
72+
<li><code>-10^8 &lt;= arr[i] &lt;= 10^8</code></li>
73+
</ul>
74+
75+
### Related Topics
76+
[[Breadth-first Search](../../tag/breadth-first-search/README.md)]
77+
78+
### Hints
79+
<details>
80+
<summary>Hint 1</summary>
81+
Build a graph of n nodes where nodes are the indices of the array and edges for node i are nodes i+1, i-1, j where arr[i] == arr[j].
82+
</details>
83+
84+
<details>
85+
<summary>Hint 2</summary>
86+
Start bfs from node 0 and keep distance, answer is the distance when you reach onode n-1.
87+
</details>

problems/jump-game-v/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[< Previous](../maximum-product-of-splitted-binary-tree "Maximum Product of Splitted Binary Tree")
99

10-
Next >
10+
[Next >](../movie-rating "Movie Rating")
1111

1212
## [1340. Jump Game V (Hard)](https://leetcode.com/problems/jump-game-v "跳跃游戏 V")
1313

problems/last-person-to-fit-in-the-elevator/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
[Next >](../monthly-transactions-ii "Monthly Transactions II")
1111

12-
## [1204. Last Person to Fit in the Elevator (Medium)](https://leetcode.com/problems/last-person-to-fit-in-the-elevator "")
12+
## [1204. Last Person to Fit in the Elevator (Medium)](https://leetcode.com/problems/last-person-to-fit-in-the-elevator "最后一个能进入电梯的人")
1313

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

0 commit comments

Comments
 (0)