Skip to content

Commit 3ae8bd8

Browse files
author
Shuo
authored
Merge pull request #583 from openset/develop
Add: new
2 parents 26e7b76 + 17fe4e2 commit 3ae8bd8

File tree

16 files changed

+216
-7
lines changed

16 files changed

+216
-7
lines changed

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ LeetCode Problems' Solutions
5454

5555
| # | Title | Solution | Difficulty |
5656
| :-: | - | - | :-: |
57+
| <span id="1081">1081</span> | [Smallest Subsequence of Distinct Characters](https://leetcode.com/problems/smallest-subsequence-of-distinct-characters "不同字符的最小子序列") | [Go](https://github.com/openset/leetcode/tree/master/problems/smallest-subsequence-of-distinct-characters) | Medium |
58+
| <span id="1080">1080</span> | [Insufficient Nodes in Root to Leaf Paths](https://leetcode.com/problems/insufficient-nodes-in-root-to-leaf-paths "根到叶路径上的不足节点") | [Go](https://github.com/openset/leetcode/tree/master/problems/insufficient-nodes-in-root-to-leaf-paths) | Medium |
59+
| <span id="1079">1079</span> | [Letter Tile Possibilities](https://leetcode.com/problems/letter-tile-possibilities "活字印刷") | [Go](https://github.com/openset/leetcode/tree/master/problems/letter-tile-possibilities) | Medium |
60+
| <span id="1078">1078</span> | [Occurrences After Bigram](https://leetcode.com/problems/occurrences-after-bigram "Bigram 分词") | [Go](https://github.com/openset/leetcode/tree/master/problems/occurrences-after-bigram) | Easy |
5761
| <span id="1077">1077</span> | [Project Employees III](https://leetcode.com/problems/project-employees-iii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/project-employees-iii) | Medium |
5862
| <span id="1076">1076</span> | [Project Employees II](https://leetcode.com/problems/project-employees-ii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/project-employees-ii) | Easy |
5963
| <span id="1075">1075</span> | [Project Employees I](https://leetcode.com/problems/project-employees-i) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/project-employees-i) | Easy |

Diff for: problems/binary-tree-cameras/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
</div>
4949

5050
### Related Topics
51+
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
5152
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
5253
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
53-
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
5454

5555
### Similar Questions
5656
1. [Distribute Coins in Binary Tree](https://github.com/openset/leetcode/tree/master/problems/distribute-coins-in-binary-tree) (Medium)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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](https://github.com/openset/leetcode/tree/master/problems/letter-tile-possibilities "Letter Tile Possibilities")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/smallest-subsequence-of-distinct-characters "Smallest Subsequence of Distinct Characters")
11+
12+
## 1080. Insufficient Nodes in Root to Leaf Paths (Medium)
13+
14+
<p>Given the <code>root</code>&nbsp;of a binary tree, consider all <em>root to leaf paths</em>: paths from the root&nbsp;to any leaf.&nbsp; (A leaf is a node with no children.)</p>
15+
16+
<p>A <code>node</code> is <em>insufficient</em> if&nbsp;<strong>every</strong> such root to leaf path intersecting this <code>node</code> has sum strictly less than&nbsp;<code>limit</code>.</p>
17+
18+
<p>Delete all insufficient nodes simultaneously, and return the root of the resulting&nbsp;binary tree.</p>
19+
20+
<p>&nbsp;</p>
21+
22+
<p><strong>Example 1:</strong></p>
23+
24+
<pre>
25+
<strong><img alt="" src="https://assets.leetcode.com/uploads/2019/06/05/insufficient-11.png" style="width: 482px; height: 200px;" />
26+
Input: </strong>root = <span id="example-input-1-1">[1,2,3,4,-99,-99,7,8,9,-99,-99,12,13,-99,14]</span>, limit = <span id="example-input-1-2">1</span>
27+
<strong><img alt="" src="https://assets.leetcode.com/uploads/2019/06/05/insufficient-2.png" style="width: 258px; height: 200px;" />
28+
Output: </strong><span id="example-output-1">[1,2,3,4,null,null,7,8,9,null,14]</span>
29+
</pre>
30+
31+
<div>
32+
<p><strong>Example 2:</strong></p>
33+
34+
<pre>
35+
<strong><img alt="" src="https://assets.leetcode.com/uploads/2019/06/05/insufficient-3.png" style="width: 292px; height: 200px;" />
36+
Input: </strong>root = <span id="example-input-2-1">[5,4,8,11,null,17,4,7,1,null,null,5,3]</span>, limit = <span id="example-input-2-2">22</span>
37+
<strong><img alt="" src="https://assets.leetcode.com/uploads/2019/06/05/insufficient-4.png" style="width: 264px; height: 200px;" />
38+
Output: </strong><span id="example-output-2">[5,4,8,11,null,17,4,7,null,null,null,5]</span></pre>
39+
</div>
40+
41+
<p>&nbsp;</p>
42+
43+
<p><strong>Note:</strong></p>
44+
45+
<ol>
46+
<li>The given tree will have between <code>1</code> and <code>5000</code> nodes.</li>
47+
<li><code>-10^5&nbsp;&lt;= node.val &lt;= 10^5</code></li>
48+
<li><code>-10^9 &lt;= limit&nbsp;&lt;= 10^9</code></li>
49+
</ol>
50+
51+
<div>
52+
<div>&nbsp;</div>
53+
</div>

Diff for: problems/is-subsequence/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ If there are lots of incoming S, say S1, S2, ... , Sk where k >= 1B, and you wan
4949

5050
### Similar Questions
5151
1. [Number of Matching Subsequences](https://github.com/openset/leetcode/tree/master/problems/number-of-matching-subsequences) (Medium)
52+
1. [Shortest Way to Form String](https://github.com/openset/leetcode/tree/master/problems/shortest-way-to-form-string) (Medium)

Diff for: problems/k-closest-points-to-origin/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ We only want the closest K = 1 points from the origin, so the answer is just [[-
5454
</div>
5555

5656
### Related Topics
57+
[[Divide and Conquer](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)]
5758
[[Heap](https://github.com/openset/leetcode/tree/master/tag/heap/README.md)]
5859
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
59-
[[Divide and Conquer](https://github.com/openset/leetcode/tree/master/tag/divide-and-conquer/README.md)]
6060

6161
### Similar Questions
6262
1. [Kth Largest Element in an Array](https://github.com/openset/leetcode/tree/master/problems/kth-largest-element-in-an-array) (Medium)

Diff for: problems/largest-perimeter-triangle/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
</div>
6767

6868
### Related Topics
69-
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
7069
[[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
70+
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
7171

7272
### Similar Questions
7373
1. [Largest Triangle Area](https://github.com/openset/leetcode/tree/master/problems/largest-triangle-area) (Easy)

Diff for: problems/letter-tile-possibilities/README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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](https://github.com/openset/leetcode/tree/master/problems/occurrences-after-bigram "Occurrences After Bigram")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/insufficient-nodes-in-root-to-leaf-paths "Insufficient Nodes in Root to Leaf Paths")
11+
12+
## 1079. Letter Tile Possibilities (Medium)
13+
14+
<p>You have a set of <code>tiles</code>, where each tile has one letter <code>tiles[i]</code> printed on it.&nbsp; Return the number of possible non-empty sequences of letters you can make.</p>
15+
16+
<p>&nbsp;</p>
17+
18+
<p><strong>Example 1:</strong></p>
19+
20+
<pre>
21+
<strong>Input: </strong><span id="example-input-1-1">&quot;AAB&quot;</span>
22+
<strong>Output: </strong><span id="example-output-1">8</span>
23+
<strong>Explanation: </strong>The possible sequences are &quot;A&quot;, &quot;B&quot;, &quot;AA&quot;, &quot;AB&quot;, &quot;BA&quot;, &quot;AAB&quot;, &quot;ABA&quot;, &quot;BAA&quot;.
24+
</pre>
25+
26+
<div>
27+
<p><strong>Example 2:</strong></p>
28+
29+
<pre>
30+
<strong>Input: </strong><span id="example-input-2-1">&quot;AAABBC&quot;</span>
31+
<strong>Output: </strong><span id="example-output-2">188</span>
32+
</pre>
33+
34+
<p>&nbsp;</p>
35+
</div>
36+
37+
<p><strong>Note:</strong></p>
38+
39+
<ol>
40+
<li><code>1 &lt;= tiles.length &lt;= 7</code></li>
41+
<li><code>tiles</code> consists of uppercase English letters.</li>
42+
</ol>

Diff for: problems/minimum-area-rectangle-ii/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@
7676
</ol>
7777

7878
### Related Topics
79-
[[Geometry](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)]
8079
[[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
80+
[[Geometry](https://github.com/openset/leetcode/tree/master/tag/geometry/README.md)]

Diff for: problems/occurrences-after-bigram/README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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](https://github.com/openset/leetcode/tree/master/problems/project-employees-iii "Project Employees III")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/letter-tile-possibilities "Letter Tile Possibilities")
11+
12+
## 1078. Occurrences After Bigram (Easy)
13+
14+
<p>Given words <code>first</code> and <code>second</code>, consider occurrences in some&nbsp;<code>text</code> of the form &quot;<code>first second third</code>&quot;, where <code>second</code> comes immediately after <code>first</code>, and <code>third</code> comes immediately after <code>second</code>.</p>
15+
16+
<p>For each such occurrence, add &quot;<code>third</code>&quot; to the answer, and return the answer.</p>
17+
18+
<p>&nbsp;</p>
19+
20+
<p><strong>Example 1:</strong></p>
21+
22+
<pre>
23+
<strong>Input: </strong>text = <span id="example-input-1-1">&quot;alice is a good girl she is a good student&quot;</span>, first = <span id="example-input-1-2">&quot;a&quot;</span>, second = <span id="example-input-1-3">&quot;good&quot;</span>
24+
<strong>Output: </strong><span id="example-output-1">[&quot;girl&quot;,&quot;student&quot;]</span>
25+
</pre>
26+
27+
<div>
28+
<p><strong>Example 2:</strong></p>
29+
30+
<pre>
31+
<strong>Input: </strong>text = <span id="example-input-2-1">&quot;we will we will rock you&quot;</span>, first = <span id="example-input-2-2">&quot;we&quot;</span>, second = <span id="example-input-2-3">&quot;will&quot;</span>
32+
<strong>Output: </strong><span id="example-output-2">[&quot;we&quot;,&quot;rock&quot;]</span>
33+
</pre>
34+
35+
<p>&nbsp;</p>
36+
37+
<p><strong>Note:</strong></p>
38+
39+
<ol>
40+
<li><code>1 &lt;= text.length &lt;= 1000</code></li>
41+
<li><code>text</code> consists of space separated words, where each word consists of lowercase English letters.</li>
42+
<li><code>1 &lt;= first.length, second.length &lt;= 10</code></li>
43+
<li><code>first</code> and <code>second</code> consist of lowercase English letters.</li>
44+
</ol>
45+
</div>

Diff for: problems/odd-even-jump/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ We can reach the end from starting indexes 1, 2, and 4.
8787
</ol>
8888

8989
### Related Topics
90-
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
9190
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
91+
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
9292
[[Ordered Map](https://github.com/openset/leetcode/tree/master/tag/ordered-map/README.md)]

Diff for: problems/pancake-sorting/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ Note that other answers, such as [3, 3], would also be accepted.
5252
</ol>
5353

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

Diff for: problems/project-employees-i/project_employees_i.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Write your MySQL query statement below
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Write your MySQL query statement below

Diff for: problems/project-employees-iii/README.md

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

88
[< Previous](https://github.com/openset/leetcode/tree/master/problems/project-employees-ii "Project Employees II")
99

10-
Next >
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/occurrences-after-bigram "Occurrences After Bigram")
1111

1212
## 1077. Project Employees III (Medium)
1313

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Write your MySQL query statement below
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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](https://github.com/openset/leetcode/tree/master/problems/insufficient-nodes-in-root-to-leaf-paths "Insufficient Nodes in Root to Leaf Paths")
9+
                
10+
Next >
11+
12+
## 1081. Smallest Subsequence of Distinct Characters (Medium)
13+
14+
<p>Return the lexicographically smallest subsequence of <code>text</code> that contains all the distinct characters of <code>text</code> exactly once.</p>
15+
16+
<p>&nbsp;</p>
17+
18+
<p><strong>Example 1:</strong></p>
19+
20+
<pre>
21+
<strong>Input: </strong><span id="example-input-1-1">&quot;cdadabcc&quot;</span>
22+
<strong>Output: </strong><span id="example-output-1">&quot;adbc&quot;</span>
23+
</pre>
24+
25+
<div>
26+
<p><strong>Example 2:</strong></p>
27+
28+
<pre>
29+
<strong>Input: </strong><span id="example-input-2-1">&quot;abcd&quot;</span>
30+
<strong>Output: </strong><span id="example-output-2">&quot;abcd&quot;</span>
31+
</pre>
32+
33+
<div>
34+
<p><strong>Example 3:</strong></p>
35+
36+
<pre>
37+
<strong>Input: </strong><span id="example-input-3-1">&quot;ecbacba&quot;</span>
38+
<strong>Output: </strong><span id="example-output-3">&quot;eacb&quot;</span>
39+
</pre>
40+
41+
<div>
42+
<p><strong>Example 4:</strong></p>
43+
44+
<pre>
45+
<strong>Input: </strong><span id="example-input-4-1">&quot;leetcode&quot;</span>
46+
<strong>Output: </strong><span id="example-output-4">&quot;letcod&quot;</span>
47+
</pre>
48+
49+
<p>&nbsp;</p>
50+
51+
<p><strong>Note:</strong></p>
52+
53+
<ol>
54+
<li><code>1 &lt;= text.length &lt;= 1000</code></li>
55+
<li><code>text</code> consists of lowercase English letters.</li>
56+
</ol>
57+
58+
<p>&nbsp;</p>
59+
</div>
60+
</div>
61+
</div>

0 commit comments

Comments
 (0)