Skip to content

Commit cb5397d

Browse files
author
Shuo
authored
Merge pull request #627 from openset/develop
Add: new
2 parents 0486c5b + 516e9be commit cb5397d

File tree

31 files changed

+532
-20
lines changed

31 files changed

+532
-20
lines changed

README.md

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

5555
| # | Title | Solution | Difficulty |
5656
| :-: | - | - | :-: |
57+
| <span id="1172">1172</span> | [Dinner Plate Stacks](https://leetcode.com/problems/dinner-plate-stacks "餐盘栈") | [Go](https://github.com/openset/leetcode/tree/master/problems/dinner-plate-stacks) | Hard |
58+
| <span id="1171">1171</span> | [Remove Zero Sum Consecutive Nodes from Linked List](https://leetcode.com/problems/remove-zero-sum-consecutive-nodes-from-linked-list "从链表中删去总和值为零的连续节点") | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-zero-sum-consecutive-nodes-from-linked-list) | Medium |
59+
| <span id="1170">1170</span> | [Compare Strings by Frequency of the Smallest Character](https://leetcode.com/problems/compare-strings-by-frequency-of-the-smallest-character "比较字符串最小字母出现频次") | [Go](https://github.com/openset/leetcode/tree/master/problems/compare-strings-by-frequency-of-the-smallest-character) | Easy |
60+
| <span id="1169">1169</span> | [Invalid Transactions](https://leetcode.com/problems/invalid-transactions "查询无效交易") | [Go](https://github.com/openset/leetcode/tree/master/problems/invalid-transactions) | Easy |
61+
| <span id="1168">1168</span> | [Optimize Water Distribution in a Village](https://leetcode.com/problems/optimize-water-distribution-in-a-village "水资源分配优化") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/optimize-water-distribution-in-a-village) | Hard |
62+
| <span id="1167">1167</span> | [Minimum Cost to Connect Sticks](https://leetcode.com/problems/minimum-cost-to-connect-sticks "连接棒材的最低费用") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/minimum-cost-to-connect-sticks) | Medium |
63+
| <span id="1166">1166</span> | [Design File System](https://leetcode.com/problems/design-file-system "设计文件系统") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/design-file-system) | Medium |
64+
| <span id="1165">1165</span> | [Single-Row Keyboard](https://leetcode.com/problems/single-row-keyboard "单行键盘") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/single-row-keyboard) | Easy |
65+
| <span id="1164">1164</span> | [Product Price at a Given Date](https://leetcode.com/problems/product-price-at-a-given-date) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-price-at-a-given-date) | Medium |
5766
| <span id="1163">1163</span> | [Last Substring in Lexicographical Order](https://leetcode.com/problems/last-substring-in-lexicographical-order "按字典序排在最后的子串") | [Go](https://github.com/openset/leetcode/tree/master/problems/last-substring-in-lexicographical-order) | Hard |
5867
| <span id="1162">1162</span> | [As Far from Land as Possible](https://leetcode.com/problems/as-far-from-land-as-possible "地图分析") | [Go](https://github.com/openset/leetcode/tree/master/problems/as-far-from-land-as-possible) | Medium |
5968
| <span id="1161">1161</span> | [Maximum Level Sum of a Binary Tree](https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree "最大层内元素和") | [Go](https://github.com/openset/leetcode/tree/master/problems/maximum-level-sum-of-a-binary-tree) | Medium |
@@ -119,7 +128,7 @@ LeetCode Problems' Solutions
119128
| <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 |
120129
| <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 |
121130
| <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 |
122-
| <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 |
131+
| <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 |
123132
| <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 |
124133
| <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 |
125134
| <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 |
@@ -135,20 +144,20 @@ LeetCode Problems' Solutions
135144
| <span id="1085">1085</span> | [Sum of Digits in the Minimum Number](https://leetcode.com/problems/sum-of-digits-in-the-minimum-number "最小元素各数位之和") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/sum-of-digits-in-the-minimum-number) | Easy |
136145
| <span id="1084">1084</span> | [Sales Analysis III](https://leetcode.com/problems/sales-analysis-iii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-iii) | Easy |
137146
| <span id="1083">1083</span> | [Sales Analysis II](https://leetcode.com/problems/sales-analysis-ii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-ii) | Easy |
138-
| <span id="1082">1082</span> | [Sales Analysis I](https://leetcode.com/problems/sales-analysis-i) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-i) | Easy |
147+
| <span id="1082">1082</span> | [Sales Analysis I](https://leetcode.com/problems/sales-analysis-i "销售分析 I ") 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/sales-analysis-i) | Easy |
139148
| <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 |
140149
| <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 |
141150
| <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 |
142151
| <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 |
143-
| <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 |
152+
| <span id="1077">1077</span> | [Project Employees III](https://leetcode.com/problems/project-employees-iii "项目员工 III") 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/project-employees-iii) | Medium |
144153
| <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 |
145154
| <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 |
146155
| <span id="1074">1074</span> | [Number of Submatrices That Sum to Target](https://leetcode.com/problems/number-of-submatrices-that-sum-to-target "元素和为目标值的子矩阵数量") | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-submatrices-that-sum-to-target) | Hard |
147156
| <span id="1073">1073</span> | [Adding Two Negabinary Numbers](https://leetcode.com/problems/adding-two-negabinary-numbers "负二进制数相加") | [Go](https://github.com/openset/leetcode/tree/master/problems/adding-two-negabinary-numbers) | Medium |
148157
| <span id="1072">1072</span> | [Flip Columns For Maximum Number of Equal Rows](https://leetcode.com/problems/flip-columns-for-maximum-number-of-equal-rows "按列翻转得到最大值等行数") | [Go](https://github.com/openset/leetcode/tree/master/problems/flip-columns-for-maximum-number-of-equal-rows) | Medium |
149158
| <span id="1071">1071</span> | [Greatest Common Divisor of Strings](https://leetcode.com/problems/greatest-common-divisor-of-strings "字符串的最大公因子") | [Go](https://github.com/openset/leetcode/tree/master/problems/greatest-common-divisor-of-strings) | Easy |
150159
| <span id="1070">1070</span> | [Product Sales Analysis III](https://leetcode.com/problems/product-sales-analysis-iii) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-iii) | Medium |
151-
| <span id="1069">1069</span> | [Product Sales Analysis II](https://leetcode.com/problems/product-sales-analysis-ii "销售分析Ⅱ") 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-ii) | Easy |
160+
| <span id="1069">1069</span> | [Product Sales Analysis II](https://leetcode.com/problems/product-sales-analysis-ii "产品销售分析 II") 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-ii) | Easy |
152161
| <span id="1068">1068</span> | [Product Sales Analysis I](https://leetcode.com/problems/product-sales-analysis-i) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/product-sales-analysis-i) | Easy |
153162
| <span id="1067">1067</span> | [Digit Count in Range](https://leetcode.com/problems/digit-count-in-range "范围内的数字计数") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/digit-count-in-range) | Hard |
154163
| <span id="1066">1066</span> | [Campus Bikes II](https://leetcode.com/problems/campus-bikes-ii "校园自行车分配 II") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/campus-bikes-ii) | Medium |

problems/analyze-user-website-visit-pattern/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515

1616
### Related Topics
17+
[[Sort](https://github.com/openset/leetcode/tree/master/tag/sort/README.md)]
1718
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
1819
[[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)]
2020

2121
### Hints
2222
<details>

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-
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
4847
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
48+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/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)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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/invalid-transactions "Invalid Transactions")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/remove-zero-sum-consecutive-nodes-from-linked-list "Remove Zero Sum Consecutive Nodes from Linked List")
11+
12+
## 1170. Compare Strings by Frequency of the Smallest Character (Easy)
13+
14+
<p>Let&#39;s define a function <code>f(s)</code> over a non-empty string <code>s</code>, which calculates the frequency of the smallest character in <code>s</code>. For example,&nbsp;if <code>s = &quot;dcce&quot;</code> then <code>f(s) = 2</code> because the smallest character is <code>&quot;c&quot;</code> and its frequency is 2.</p>
15+
16+
<p>Now, given string arrays <code>queries</code>&nbsp;and <code>words</code>, return an integer array <code>answer</code>, where each <code>answer[i]</code>&nbsp;is the number of words such that <code>f(queries[i])</code>&nbsp;&lt; <code>f(W)</code>, where <code>W</code>&nbsp;is a word in <code>words</code>.</p>
17+
18+
<p>&nbsp;</p>
19+
<p><strong>Example 1:</strong></p>
20+
21+
<pre>
22+
<strong>Input:</strong> queries = [&quot;cbd&quot;], words = [&quot;zaaaz&quot;]
23+
<strong>Output:</strong> [1]
24+
<strong>Explanation:</strong> On the first query we have f(&quot;cbd&quot;) = 1, f(&quot;zaaaz&quot;) = 3 so f(&quot;cbd&quot;) &lt; f(&quot;zaaaz&quot;).
25+
</pre>
26+
27+
<p><strong>Example 2:</strong></p>
28+
29+
<pre>
30+
<strong>Input:</strong> queries = [&quot;bbb&quot;,&quot;cc&quot;], words = [&quot;a&quot;,&quot;aa&quot;,&quot;aaa&quot;,&quot;aaaa&quot;]
31+
<strong>Output:</strong> [1,2]
32+
<strong>Explanation:</strong> On the first query only f(&quot;bbb&quot;) &lt; f(&quot;aaaa&quot;). On the second query both f(&quot;aaa&quot;) and f(&quot;aaaa&quot;) are both &gt; f(&quot;cc&quot;).
33+
</pre>
34+
35+
<p>&nbsp;</p>
36+
<p><strong>Constraints:</strong></p>
37+
38+
<ul>
39+
<li><code>1 &lt;= queries.length &lt;= 2000</code></li>
40+
<li><code>1 &lt;= words.length &lt;= 2000</code></li>
41+
<li><code>1 &lt;= queries[i].length, words[i].length &lt;= 10</code></li>
42+
<li><code>queries[i][j]</code>, <code>words[i][j]</code> are English lowercase letters.</li>
43+
</ul>
44+
45+
### Related Topics
46+
[[Array](https://github.com/openset/leetcode/tree/master/tag/array/README.md)]
47+
[[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)]
48+
49+
### Hints
50+
<details>
51+
<summary>Hint 1</summary>
52+
For each string from words calculate the leading count and store it in an array, then sort the integer array.
53+
</details>
54+
55+
<details>
56+
<summary>Hint 2</summary>
57+
For each string from queries calculate the leading count "p" and in base of the sorted array calculated on the step 1 do a binary search to count the number of items greater than "p".
58+
</details>

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-
[[Linked List](https://github.com/openset/leetcode/tree/master/tag/linked-list/README.md)]
3433
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
34+
[[Linked List](https://github.com/openset/leetcode/tree/master/tag/linked-list/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)

problems/design-file-system/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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/single-row-keyboard "Single-Row Keyboard")
9+
                
10+
[Next >](https://github.com/openset/leetcode/tree/master/problems/minimum-cost-to-connect-sticks "Minimum Cost to Connect Sticks")
11+
12+
## 1166. Design File System (Medium)
13+
14+
15+
16+
### Related Topics
17+
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
18+
[[Design](https://github.com/openset/leetcode/tree/master/tag/design/README.md)]
19+
20+
### Hints
21+
<details>
22+
<summary>Hint 1</summary>
23+
What if you think of a tree hierarchy for the files?.
24+
</details>
25+
26+
<details>
27+
<summary>Hint 2</summary>
28+
A path is a node in the tree.
29+
</details>
30+
31+
<details>
32+
<summary>Hint 3</summary>
33+
Use a hash table to store the valid paths along with their values.
34+
</details>

0 commit comments

Comments
 (0)