Skip to content

Commit 6884e68

Browse files
author
Shuo
authored
Merge pull request #600 from openset/develop
Add: new
2 parents 388c65d + 2ff1a3c commit 6884e68

File tree

59 files changed

+597
-112
lines changed

Some content is hidden

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

59 files changed

+597
-112
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ LeetCode Problems' Solutions
5454

5555
| # | Title | Solution | Difficulty |
5656
| :-: | - | - | :-: |
57+
| <span id="1102">1102</span> | [Path With Maximum Minimum Value](https://leetcode.com/problems/path-with-maximum-minimum-value "得分最高的路径") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/path-with-maximum-minimum-value) | Medium |
58+
| <span id="1101">1101</span> | [The Earliest Moment When Everyone Become Friends](https://leetcode.com/problems/the-earliest-moment-when-everyone-become-friends "彼此熟识的最早时间") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/the-earliest-moment-when-everyone-become-friends) | Medium |
59+
| <span id="1100">1100</span> | [Find K-Length Substrings With No Repeated Characters](https://leetcode.com/problems/find-k-length-substrings-with-no-repeated-characters "长度为 K 的无重复字符子串") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/find-k-length-substrings-with-no-repeated-characters) | Medium |
60+
| <span id="1099">1099</span> | [Two Sum Less Than K](https://leetcode.com/problems/two-sum-less-than-k "小于 K 的两数之和") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/two-sum-less-than-k) | Easy |
61+
| <span id="1098">1098</span> | [Unpopular Books](https://leetcode.com/problems/unpopular-books) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/unpopular-books) | Medium |
62+
| <span id="1097">1097</span> | [Game Play Analysis V](https://leetcode.com/problems/game-play-analysis-v) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-v) | Hard |
5763
| <span id="1096">1096</span> | [Brace Expansion II](https://leetcode.com/problems/brace-expansion-ii "花括号展开 II") | [Go](https://github.com/openset/leetcode/tree/master/problems/brace-expansion-ii) | Hard |
5864
| <span id="1095">1095</span> | [Find in Mountain Array](https://leetcode.com/problems/find-in-mountain-array "山脉数组中查找目标值") | [Go](https://github.com/openset/leetcode/tree/master/problems/find-in-mountain-array) | Hard |
5965
| <span id="1094">1094</span> | [Car Pooling](https://leetcode.com/problems/car-pooling "拼车") | [Go](https://github.com/openset/leetcode/tree/master/problems/car-pooling) | Medium |

problems/3sum-smaller/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
1. [3Sum](https://github.com/openset/leetcode/tree/master/problems/3sum) (Medium)
2222
1. [3Sum Closest](https://github.com/openset/leetcode/tree/master/problems/3sum-closest) (Medium)
2323
1. [Valid Triangle Number](https://github.com/openset/leetcode/tree/master/problems/valid-triangle-number) (Medium)
24+
1. [Two Sum Less Than K](https://github.com/openset/leetcode/tree/master/problems/two-sum-less-than-k) (Easy)

problems/brace-expansion-ii/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[< Previous](https://github.com/openset/leetcode/tree/master/problems/find-in-mountain-array "Find in Mountain Array")
99

10-
Next >
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/game-play-analysis-v "Game Play Analysis V")
1111

1212
## 1096. Brace Expansion II (Hard)
1313

@@ -31,7 +31,7 @@ Next >
3131
<li>When we concatenate two expressions, we take the set of possible concatenations between two words where the first word comes from the first expression and the second word comes from the second expression.
3232
<ul>
3333
<li><code>R(&quot;{a,b}{c,d}&quot;) = {&quot;ac&quot;,&quot;ad&quot;,&quot;bc&quot;,&quot;bd&quot;}</code></li>
34-
<li><code>R(&quot;{a{b,c}}{{d,e},f{g,h}}&quot;) = R(&quot;{ab,ac}{dfg,dfh,efg,efh}&quot;) = {&quot;abdfg&quot;, &quot;abdfh&quot;, &quot;abefg&quot;, &quot;abefh&quot;, &quot;acdfg&quot;, &quot;acdfh&quot;, &quot;acefg&quot;, &quot;acefh&quot;}</code></li>
34+
<li><code>R(&quot;{a{b,c}}{{d,e}f{g,h}}&quot;) = R(&quot;{ab,ac}{dfg,dfh,efg,efh}&quot;) = {&quot;abdfg&quot;, &quot;abdfh&quot;, &quot;abefg&quot;, &quot;abefh&quot;, &quot;acdfg&quot;, &quot;acdfh&quot;, &quot;acefg&quot;, &quot;acefh&quot;}</code></li>
3535
</ul>
3636
</li>
3737
</ul>
@@ -76,3 +76,12 @@ Next >
7676
</ol>
7777
</div>
7878
</div>
79+
80+
### Related Topics
81+
[[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)]
82+
83+
### Hints
84+
<details>
85+
<summary>Hint 1</summary>
86+
You can write helper methods to parse the next "chunk" of the expression. If you see eg. "a", the answer is just the set {a}. If you see "{", you parse until you complete the "}" (the number of { and } seen are equal) and that becomes a chunk that you find where the appropriate commas are, and parse each individual expression between the commas.
87+
</details>

problems/car-fleet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ Note that no other cars meet these fleets before the destination, so the answer
5252
</ol>
5353

5454
### Related Topics
55-
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
55+
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]

problems/car-pooling/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,12 @@
7171
<li><code>0 &lt;= trips[i][1] &lt; trips[i][2] &lt;= 1000</code></li>
7272
<li><code>1 &lt;=&nbsp;capacity &lt;= 100000</code></li>
7373
</ol>
74+
75+
### Related Topics
76+
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
77+
78+
### Hints
79+
<details>
80+
<summary>Hint 1</summary>
81+
Sort the pickup and dropoff events by location, then process them in order.
82+
</details>

problems/construct-quad-tree/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/serialize-and-deserialize-n-ary-tree "Serialize and Deserialize N-ary Tree")
1111

12-
## 427. Construct Quad Tree (Easy)
12+
## 427. Construct Quad Tree (Medium)
1313

1414
<p>We want to use quad trees to store an <code>N x N</code> boolean grid. Each cell in the grid can only be true or false. The root node represents the whole grid. For each node, it will be subdivided into four children nodes <strong>until the values in the region it represents are all the same</strong>.</p>
1515

problems/continuous-subarray-sum/README.md

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

1212
## 523. Continuous Subarray Sum (Medium)
1313

14-
<p>Given a list of <b>non-negative</b> numbers and a target <b>integer</b> k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of <b>k</b>, that is, sums up to n*k where n is also an <b>integer</b>.</p>
14+
<p>Given a list of <b>non-negative</b> numbers and a target <b>integer</b> k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to a multiple of <b>k</b>, that is, sums up to n*k where n is also an <b>integer</b>.</p>
1515

1616
<p>&nbsp;</p>
1717

problems/cracking-the-safe/README.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,43 @@
1111

1212
## 753. Cracking the Safe (Hard)
1313

14-
<p>
15-
There is a box protected by a password. The password is <code>n</code> digits, where each letter can be one of the first <code>k</code> digits <code>0, 1, ..., k-1</code>.
16-
</p><p>
17-
You can keep inputting the password, the password will automatically be matched against the last <code>n</code> digits entered.
18-
</p><p>
19-
For example, assuming the password is <code>"345"</code>, I can open it when I type <code>"012345"</code>, but I enter a total of 6 digits.
20-
</p><p>
21-
Please return any string of minimum length that is guaranteed to open the box after the entire string is inputted.
22-
</p>
23-
24-
<p><b>Example 1:</b><br />
14+
<p>There is a box protected by a password. The password is a sequence of&nbsp;<code>n</code> digits&nbsp;where each digit can be one of the first <code>k</code> digits <code>0, 1, ..., k-1</code>.</p>
15+
16+
<p>While entering a password,&nbsp;the last <code>n</code> digits entered will automatically be matched against the correct password.</p>
17+
18+
<p>For example, assuming the correct password is <code>&quot;345&quot;</code>,&nbsp;if you type <code>&quot;012345&quot;</code>, the box will open because the correct password matches the suffix of the entered password.</p>
19+
20+
<p>Return any password of <strong>minimum length</strong> that is guaranteed to open the box at some point of entering it.</p>
21+
22+
<p>&nbsp;</p>
23+
24+
<p><b>Example 1:</b></p>
25+
2526
<pre>
2627
<b>Input:</b> n = 1, k = 2
27-
<b>Output:</b> "01"
28-
<b>Note:</b> "10" will be accepted too.
28+
<b>Output:</b> &quot;01&quot;
29+
<b>Note:</b> &quot;10&quot; will be accepted too.
2930
</pre>
30-
</p>
3131

32-
<p><b>Example 2:</b><br />
32+
<p><b>Example 2:</b></p>
33+
3334
<pre>
3435
<b>Input:</b> n = 2, k = 2
35-
<b>Output:</b> "00110"
36-
<b>Note:</b> "01100", "10011", "11001" will be accepted too.
36+
<b>Output:</b> &quot;00110&quot;
37+
<b>Note:</b> &quot;01100&quot;, &quot;10011&quot;, &quot;11001&quot; will be accepted too.
3738
</pre>
38-
</p>
3939

40-
<p><b>Note:</b><br>
40+
<p>&nbsp;</p>
41+
42+
<p><b>Note:</b></p>
43+
4144
<ol>
42-
<li><code>n</code> will be in the range <code>[1, 4]</code>.</li>
43-
<li><code>k</code> will be in the range <code>[1, 10]</code>.</li>
44-
<li><code>k^n</code> will be at most <code>4096</code>.</li>
45+
<li><code>n</code> will be in the range <code>[1, 4]</code>.</li>
46+
<li><code>k</code> will be in the range <code>[1, 10]</code>.</li>
47+
<li><code>k^n</code> will be at most <code>4096</code>.</li>
4548
</ol>
46-
</p>
49+
50+
<p>&nbsp;</p>
4751

4852
### Related Topics
4953
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]

problems/decode-string/README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,23 @@
1111

1212
## 394. Decode String (Medium)
1313

14-
<p>
15-
Given an encoded string, return it's decoded string.
16-
</p>
17-
<p>
18-
The encoding rule is: <code>k[encoded_string]</code>, where the <i>encoded_string</i> inside the square brackets is being repeated exactly <i>k</i> times. Note that <i>k</i> is guaranteed to be a positive integer.</p>
14+
<p>Given an encoded string, return its decoded string.</p>
1915

20-
<p>
21-
You may assume that the input string is always valid; No extra white spaces, square brackets are well-formed, etc.</p>
16+
<p>The encoding rule is: <code>k[encoded_string]</code>, where the <i>encoded_string</i> inside the square brackets is being repeated exactly <i>k</i> times. Note that <i>k</i> is guaranteed to be a positive integer.</p>
2217

23-
<p>Furthermore, you may assume that the original data does not contain any digits and that digits are only for those repeat numbers, <i>k</i>. For example, there won't be input like <code>3a</code> or <code>2[4]</code>.
24-
</p>
18+
<p>You may assume that the input string is always valid; No extra white spaces, square brackets are well-formed, etc.</p>
19+
20+
<p>Furthermore, you may assume that the original data does not contain any digits and that digits are only for those repeat numbers, <i>k</i>. For example, there won&#39;t be input like <code>3a</code> or <code>2[4]</code>.</p>
21+
22+
<p><b>Examples:</b></p>
2523

26-
<p><b>Examples:</b>
2724
<pre>
28-
s = "3[a]2[bc]", return "aaabcbc".
29-
s = "3[a2[c]]", return "accaccacc".
30-
s = "2[abc]3[cd]ef", return "abcabccdcdcdef".
25+
s = &quot;3[a]2[bc]&quot;, return &quot;aaabcbc&quot;.
26+
s = &quot;3[a2[c]]&quot;, return &quot;accaccacc&quot;.
27+
s = &quot;2[abc]3[cd]ef&quot;, return &quot;abcabccdcdcdef&quot;.
3128
</pre>
32-
</p>
29+
30+
<p>&nbsp;</p>
3331

3432
### Related Topics
3533
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
@@ -38,4 +36,4 @@ s = "2[abc]3[cd]ef", return "abcabccdcdcdef".
3836
### Similar Questions
3937
1. [Encode String with Shortest Length](https://github.com/openset/leetcode/tree/master/problems/encode-string-with-shortest-length) (Hard)
4038
1. [Number of Atoms](https://github.com/openset/leetcode/tree/master/problems/number-of-atoms) (Hard)
41-
1. [Permutation of Letters](https://github.com/openset/leetcode/tree/master/problems/permutation-of-letters) (Medium)
39+
1. [Brace Expansion](https://github.com/openset/leetcode/tree/master/problems/brace-expansion) (Medium)

problems/design-compressed-string-iterator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ iterator.next(); // return ' '
5252
[[Design](https://github.com/openset/leetcode/tree/master/tag/design/README.md)]
5353

5454
### Similar Questions
55-
1. [LRU Cache](https://github.com/openset/leetcode/tree/master/problems/lru-cache) (Hard)
55+
1. [LRU Cache](https://github.com/openset/leetcode/tree/master/problems/lru-cache) (Medium)
5656
1. [String Compression](https://github.com/openset/leetcode/tree/master/problems/string-compression) (Easy)

0 commit comments

Comments
 (0)