Skip to content

Commit 1f7d2b9

Browse files
author
openset
committed
Add: new
1 parent ccb330d commit 1f7d2b9

File tree

21 files changed

+354
-11
lines changed

21 files changed

+354
-11
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,19 @@ LeetCode Problems' Solutions
5454

5555
| # | Title | Solution | Difficulty |
5656
| :-: | - | - | :-: |
57-
| <span id="1117">1117</span> | [Building H2O](https://leetcode.com/problems/building-h2o) | [Go](https://github.com/openset/leetcode/tree/master/problems/building-h2o) | Hard |
57+
| <span id="1126">1126</span> | [Active Businesses](https://leetcode.com/problems/active-businesses) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/active-businesses) | Medium |
58+
| <span id="1125">1125</span> | [Smallest Sufficient Team](https://leetcode.com/problems/smallest-sufficient-team "最小的必要团队") | [Go](https://github.com/openset/leetcode/tree/master/problems/smallest-sufficient-team) | Hard |
59+
| <span id="1124">1124</span> | [Longest Well-Performing Interval](https://leetcode.com/problems/longest-well-performing-interval "表现良好的最长时间段") | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-well-performing-interval) | Medium |
60+
| <span id="1123">1123</span> | [Lowest Common Ancestor of Deepest Leaves](https://leetcode.com/problems/lowest-common-ancestor-of-deepest-leaves "最深叶节点的最近公共祖先") | [Go](https://github.com/openset/leetcode/tree/master/problems/lowest-common-ancestor-of-deepest-leaves) | Medium |
61+
| <span id="1122">1122</span> | [Relative Sort Array](https://leetcode.com/problems/relative-sort-array "数组的相对排序") | [Go](https://github.com/openset/leetcode/tree/master/problems/relative-sort-array) | Easy |
62+
| <span id="1121">1121</span> | [Divide Array Into Increasing Sequences](https://leetcode.com/problems/divide-array-into-increasing-sequences "将数组分成几个递增序列") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/divide-array-into-increasing-sequences) | Hard |
63+
| <span id="1120">1120</span> | [Maximum Average Subtree](https://leetcode.com/problems/maximum-average-subtree "子树的最大平均值") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-average-subtree) | Medium |
64+
| <span id="1119">1119</span> | [Remove Vowels from a String](https://leetcode.com/problems/remove-vowels-from-a-string "删去字符串中的元音") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-vowels-from-a-string) | Easy |
65+
| <span id="1118">1118</span> | [Number of Days in a Month](https://leetcode.com/problems/number-of-days-in-a-month "一月有多少天") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-days-in-a-month) | Easy |
66+
| <span id="1117">1117</span> | [Building H2O](https://leetcode.com/problems/building-h2o "H2O 生成") | [Go](https://github.com/openset/leetcode/tree/master/problems/building-h2o) | Hard |
5867
| <span id="1116">1116</span> | [Print Zero Even Odd](https://leetcode.com/problems/print-zero-even-odd) | [Go](https://github.com/openset/leetcode/tree/master/problems/print-zero-even-odd) | Medium |
5968
| <span id="1115">1115</span> | [Print FooBar Alternately](https://leetcode.com/problems/print-foobar-alternately) | [Go](https://github.com/openset/leetcode/tree/master/problems/print-foobar-alternately) | Medium |
60-
| <span id="1114">1114</span> | [Print in Order](https://leetcode.com/problems/print-in-order) | [Go](https://github.com/openset/leetcode/tree/master/problems/print-in-order) | Easy |
69+
| <span id="1114">1114</span> | [Print in Order](https://leetcode.com/problems/print-in-order "按序打印") | [Go](https://github.com/openset/leetcode/tree/master/problems/print-in-order) | Easy |
6170
| <span id="1113">1113</span> | [Reported Posts](https://leetcode.com/problems/reported-posts) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/reported-posts) | Easy |
6271
| <span id="1112">1112</span> | [Highest Grade For Each Student](https://leetcode.com/problems/highest-grade-for-each-student) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/highest-grade-for-each-student) | Medium |
6372
| <span id="1111">1111</span> | [Maximum Nesting Depth of Two Valid Parentheses Strings](https://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings "有效括号的嵌套深度") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-nesting-depth-of-two-valid-parentheses-strings) | Medium |
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/smallest-sufficient-team "Smallest Sufficient Team")
9+
                
10+
Next >
11+
12+
## 1126. Active Businesses (Medium)
13+
14+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Create table If Not Exists Events (business_id int, event_type varchar(10), occurences int);
2+
Truncate table Events;
3+
insert into Events (business_id, event_type, occurences) values ('1', 'reviews', '7');
4+
insert into Events (business_id, event_type, occurences) values ('3', 'reviews', '3');
5+
insert into Events (business_id, event_type, occurences) values ('1', 'ads', '11');
6+
insert into Events (business_id, event_type, occurences) values ('2', 'ads', '7');
7+
insert into Events (business_id, event_type, occurences) values ('3', 'ads', '6');
8+
insert into Events (business_id, event_type, occurences) values ('1', 'page views', '3');
9+
insert into Events (business_id, event_type, occurences) values ('2', 'page views', '12');

problems/best-time-to-buy-and-sell-stock-ii/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<strong>Explanation:</strong> In this case, no transaction is done, i.e. max profit = 0.</pre>
4545

4646
### Related Topics
47-
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
4847
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
48+
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
4949

5050
### Similar Questions
5151
1. [Best Time to Buy and Sell Stock](https://github.com/openset/leetcode/tree/master/problems/best-time-to-buy-and-sell-stock) (Easy)

problems/binary-tree-inorder-traversal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
<p><strong>Follow up:</strong> Recursive solution is trivial, could you do it iteratively?</p>
2929

3030
### Related Topics
31+
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
3132
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
3233
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
33-
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
3434

3535
### Similar Questions
3636
1. [Validate Binary Search Tree](https://github.com/openset/leetcode/tree/master/problems/validate-binary-search-tree) (Medium)

problems/building-h2o/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/print-zero-even-odd "Print Zero Even Odd")
99

10-
Next >
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/number-of-days-in-a-month "Number of Days in a Month")
1111

1212
## 1117. Building H2O (Hard)
1313

problems/construct-binary-tree-from-inorder-and-postorder-traversal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ postorder = [9,15,7,20,3]</pre>
3333
</pre>
3434

3535
### Related Topics
36+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3637
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
3738
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
38-
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3939

4040
### Similar Questions
4141
1. [Construct Binary Tree from Preorder and Inorder Traversal](https://github.com/openset/leetcode/tree/master/problems/construct-binary-tree-from-preorder-and-inorder-traversal) (Medium)

problems/construct-binary-tree-from-preorder-and-inorder-traversal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ inorder = [9,3,15,20,7]</pre>
3232
15 7</pre>
3333

3434
### Related Topics
35+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3536
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
3637
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
37-
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
3838

3939
### Similar Questions
4040
1. [Construct Binary Tree from Inorder and Postorder Traversal](https://github.com/openset/leetcode/tree/master/problems/construct-binary-tree-from-inorder-and-postorder-traversal) (Medium)

problems/convert-sorted-list-to-binary-search-tree/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ One possible answer is: [0,-3,9,-10,null,5], which represents the following heig
3030
</pre>
3131

3232
### Related Topics
33-
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
3433
[[Linked List](https://github.com/openset/leetcode/tree/master/tag/linked-list/README.md)]
34+
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
3535

3636
### Similar Questions
3737
1. [Convert Sorted Array to Binary Search Tree](https://github.com/openset/leetcode/tree/master/problems/convert-sorted-array-to-binary-search-tree) (Easy)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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/maximum-average-subtree "Maximum Average Subtree")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/relative-sort-array "Relative Sort Array")
11+
12+
## 1121. Divide Array Into Increasing Sequences (Hard)
13+
14+
15+
16+
### Related Topics
17+
[[Math](https://github.com/openset/leetcode/tree/master/tag/math/README.md)]
18+
19+
### Hints
20+
<details>
21+
<summary>Hint 1</summary>
22+
Think in the frequency of the numbers and how this affects the number of sequences needed.
23+
</details>
24+
25+
<details>
26+
<summary>Hint 2</summary>
27+
What is the minimum number of sequences we need to form? Considering frequency of the numbers.
28+
</details>
29+
30+
<details>
31+
<summary>Hint 3</summary>
32+
Think about the least number of sequences to maximize the lengths.
33+
</details>
34+
35+
<details>
36+
<summary>Hint 4</summary>
37+
The number of sequences needed is equal to the maximum frequency of an element.
38+
</details>
39+
40+
<details>
41+
<summary>Hint 5</summary>
42+
How to put the other elements into sequences ? Think in a greedy approach.
43+
</details>

0 commit comments

Comments
 (0)