Skip to content

Commit bc3ee1b

Browse files
author
openset
committed
Add: new
1 parent 44e4aa9 commit bc3ee1b

File tree

33 files changed

+518
-20
lines changed

33 files changed

+518
-20
lines changed

README.md

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

5555
| # | Title | Solution | Difficulty |
5656
| :-: | - | - | :-: |
57+
| <span id="1157">1157</span> | [Online Majority Element In Subarray](https://leetcode.com/problems/online-majority-element-in-subarray "子数组中占绝大多数的元素") | [Go](https://github.com/openset/leetcode/tree/master/problems/online-majority-element-in-subarray) | Hard |
58+
| <span id="1156">1156</span> | [Swap For Longest Repeated Character Substring](https://leetcode.com/problems/swap-for-longest-repeated-character-substring "单字符重复子串的最大长度") | [Go](https://github.com/openset/leetcode/tree/master/problems/swap-for-longest-repeated-character-substring) | Medium |
59+
| <span id="1155">1155</span> | [Number of Dice Rolls With Target Sum](https://leetcode.com/problems/number-of-dice-rolls-with-target-sum "掷骰子的N种方法") | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-dice-rolls-with-target-sum) | Medium |
60+
| <span id="1154">1154</span> | [Day of the Year](https://leetcode.com/problems/day-of-the-year "一年中的第几天") | [Go](https://github.com/openset/leetcode/tree/master/problems/day-of-the-year) | Easy |
61+
| <span id="1153">1153</span> | [String Transforms Into Another String](https://leetcode.com/problems/string-transforms-into-another-string "字符串转化") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/string-transforms-into-another-string) | Hard |
62+
| <span id="1152">1152</span> | [Analyze User Website Visit Pattern](https://leetcode.com/problems/analyze-user-website-visit-pattern "用户网站访问行为分析") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/analyze-user-website-visit-pattern) | Medium |
63+
| <span id="1151">1151</span> | [Minimum Swaps to Group All 1's Together](https://leetcode.com/problems/minimum-swaps-to-group-all-1s-together "最少交换次数来组合所有的 1") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/minimum-swaps-to-group-all-1s-together) | Medium |
64+
| <span id="1150">1150</span> | [Check If a Number Is Majority Element in a Sorted Array](https://leetcode.com/problems/check-if-a-number-is-majority-element-in-a-sorted-array "检查一个数是否在数组中占绝大多数") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/check-if-a-number-is-majority-element-in-a-sorted-array) | Easy |
65+
| <span id="1149">1149</span> | [Article Views II](https://leetcode.com/problems/article-views-ii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/article-views-ii) | Medium |
66+
| <span id="1148">1148</span> | [Article Views I](https://leetcode.com/problems/article-views-i) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/article-views-i) | Easy |
5767
| <span id="1147">1147</span> | [Longest Chunked Palindrome Decomposition](https://leetcode.com/problems/longest-chunked-palindrome-decomposition "段式回文") | [Go](https://github.com/openset/leetcode/tree/master/problems/longest-chunked-palindrome-decomposition) | Hard |
5868
| <span id="1146">1146</span> | [Snapshot Array](https://leetcode.com/problems/snapshot-array "快照数组") | [Go](https://github.com/openset/leetcode/tree/master/problems/snapshot-array) | Medium |
5969
| <span id="1145">1145</span> | [Binary Tree Coloring Game](https://leetcode.com/problems/binary-tree-coloring-game "二叉树着色游戏") | [Go](https://github.com/openset/leetcode/tree/master/problems/binary-tree-coloring-game) | Medium |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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/minimum-swaps-to-group-all-1s-together "Minimum Swaps to Group All 1's Together")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/string-transforms-into-another-string "String Transforms Into Another String")
11+
12+
## 1152. Analyze User Website Visit Pattern (Medium)
13+
14+
15+
16+
### Related Topics
17+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
18+
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
19+
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
20+
21+
### Hints
22+
<details>
23+
<summary>Hint 1</summary>
24+
Let's find for every user separately the websites he visited.
25+
</details>
26+
27+
<details>
28+
<summary>Hint 2</summary>
29+
Consider all possible 3-sequences, find the number of distinct users who visited each of them.
30+
</details>
31+
32+
<details>
33+
<summary>Hint 3</summary>
34+
How to check if some user visited some 3-sequence ?
35+
</details>
36+
37+
<details>
38+
<summary>Hint 4</summary>
39+
Store for every user all the 3-sequence he visited.
40+
</details>

problems/article-views-i/README.md

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 <[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/longest-chunked-palindrome-decomposition "Longest Chunked Palindrome Decomposition")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/article-views-ii "Article Views II")
11+
12+
## 1148. Article Views I (Easy)
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 Views (article_id int, author_id int, viewer_id int, view_date date);
2+
Truncate table Views;
3+
insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '5', '2019-08-01');
4+
insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '6', '2019-08-02');
5+
insert into Views (article_id, author_id, viewer_id, view_date) values ('2', '7', '7', '2019-08-01');
6+
insert into Views (article_id, author_id, viewer_id, view_date) values ('2', '7', '6', '2019-08-02');
7+
insert into Views (article_id, author_id, viewer_id, view_date) values ('4', '7', '1', '2019-07-22');
8+
insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '4', '2019-07-21');
9+
insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '4', '2019-07-21');

problems/article-views-ii/README.md

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 <[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/article-views-i "Article Views I")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/check-if-a-number-is-majority-element-in-a-sorted-array "Check If a Number Is Majority Element in a Sorted Array")
11+
12+
## 1149. Article Views II (Medium)
13+
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date);
2+
Truncate table Views;
3+
insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '5', '2019-08-01');
4+
insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '5', '2019-08-01');
5+
insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '6', '2019-08-02');
6+
insert into Views (article_id, author_id, viewer_id, view_date) values ('2', '7', '7', '2019-08-01');
7+
insert into Views (article_id, author_id, viewer_id, view_date) values ('2', '7', '6', '2019-08-02');
8+
insert into Views (article_id, author_id, viewer_id, view_date) values ('4', '7', '1', '2019-07-22');
9+
insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '4', '2019-07-21');
10+
insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '4', '2019-07-21');

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/car-pooling/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
### Related Topics
7676
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
7777

78+
### Similar Questions
79+
1. [Meeting Rooms II](https://github.com/openset/leetcode/tree/master/problems/meeting-rooms-ii) (Medium)
80+
7881
### Hints
7982
<details>
8083
<summary>Hint 1</summary>
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 <[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/article-views-ii "Article Views II")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/minimum-swaps-to-group-all-1s-together "Minimum Swaps to Group All 1's Together")
11+
12+
## 1150. Check If a Number Is Majority Element in a Sorted Array (Easy)
13+
14+
15+
16+
### Related Topics
17+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
18+
[[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)]
19+
20+
### Similar Questions
21+
1. [Majority Element](https://github.com/openset/leetcode/tree/master/problems/majority-element) (Easy)
22+
1. [Majority Element II](https://github.com/openset/leetcode/tree/master/problems/majority-element-ii) (Medium)
23+
24+
### Hints
25+
<details>
26+
<summary>Hint 1</summary>
27+
How to check if a given number target is a majority element?.
28+
</details>
29+
30+
<details>
31+
<summary>Hint 2</summary>
32+
Find the frequency of target and compare it to the length of the array.
33+
</details>
34+
35+
<details>
36+
<summary>Hint 3</summary>
37+
You can find the frequency of an element using Binary Search since the array is sorted.
38+
</details>
39+
40+
<details>
41+
<summary>Hint 4</summary>
42+
Using Binary Search, find the first and last occurrences of A. Then just calculate the difference between the indexes of these occurrences.
43+
</details>

problems/climbing-stairs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
### Similar Questions
4545
1. [Min Cost Climbing Stairs](https://github.com/openset/leetcode/tree/master/problems/min-cost-climbing-stairs) (Easy)
4646
1. [Fibonacci Number](https://github.com/openset/leetcode/tree/master/problems/fibonacci-number) (Easy)
47+
1. [N-th Tribonacci Number](https://github.com/openset/leetcode/tree/master/problems/n-th-tribonacci-number) (Easy)
4748

4849
### Hints
4950
<details>

0 commit comments

Comments
 (0)