Skip to content

Commit 6312cd5

Browse files
author
Shuo
authored
Merge pull request #831 from openset/develop
A: new
2 parents 85fb899 + a13df07 commit 6312cd5

File tree

176 files changed

+2705
-1987
lines changed

Some content is hidden

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

176 files changed

+2705
-1987
lines changed

Diff for: README.md

+21-4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ LeetCode Problems' Solutions
7070

7171
| # | Title | Solution | Difficulty |
7272
| :-: | - | - | :-: |
73+
| <span id="1788">1788</span> | [Maximize the Beauty of the Garden](https://leetcode.com/problems/maximize-the-beauty-of-the-garden) 🔒 | [Go](problems/maximize-the-beauty-of-the-garden) | Hard |
74+
| <span id="1787">1787</span> | [Make the XOR of All Segments Equal to Zero](https://leetcode.com/problems/make-the-xor-of-all-segments-equal-to-zero "使所有区间的异或结果为零") | [Go](problems/make-the-xor-of-all-segments-equal-to-zero) | Hard |
75+
| <span id="1786">1786</span> | [Number of Restricted Paths From First to Last Node](https://leetcode.com/problems/number-of-restricted-paths-from-first-to-last-node "从第一个节点出发到最后一个节点的受限路径数") | [Go](problems/number-of-restricted-paths-from-first-to-last-node) | Medium |
76+
| <span id="1785">1785</span> | [Minimum Elements to Add to Form a Given Sum](https://leetcode.com/problems/minimum-elements-to-add-to-form-a-given-sum "构成特定和需要添加的最少元素") | [Go](problems/minimum-elements-to-add-to-form-a-given-sum) | Medium |
77+
| <span id="1784">1784</span> | [Check if Binary String Has at Most One Segment of Ones](https://leetcode.com/problems/check-if-binary-string-has-at-most-one-segment-of-ones "检查二进制字符串字段") | [Go](problems/check-if-binary-string-has-at-most-one-segment-of-ones) | Easy |
78+
| <span id="1783">1783</span> | [Grand Slam Titles](https://leetcode.com/problems/grand-slam-titles) 🔒 | [MySQL](problems/grand-slam-titles) | Medium |
79+
| <span id="1782">1782</span> | [Count Pairs Of Nodes](https://leetcode.com/problems/count-pairs-of-nodes "统计点对的数目") | [Go](problems/count-pairs-of-nodes) | Hard |
80+
| <span id="1781">1781</span> | [Sum of Beauty of All Substrings](https://leetcode.com/problems/sum-of-beauty-of-all-substrings "所有子字符串美丽值之和") | [Go](problems/sum-of-beauty-of-all-substrings) | Medium |
81+
| <span id="1780">1780</span> | [Check if Number is a Sum of Powers of Three](https://leetcode.com/problems/check-if-number-is-a-sum-of-powers-of-three "判断一个数字是否可以表示成三的幂的和") | [Go](problems/check-if-number-is-a-sum-of-powers-of-three) | Medium |
82+
| <span id="1779">1779</span> | [Find Nearest Point That Has the Same X or Y Coordinate](https://leetcode.com/problems/find-nearest-point-that-has-the-same-x-or-y-coordinate "找到最近的有相同 X 或 Y 坐标的点") | [Go](problems/find-nearest-point-that-has-the-same-x-or-y-coordinate) | Easy |
83+
| <span id="1778">1778</span> | [Shortest Path in a Hidden Grid](https://leetcode.com/problems/shortest-path-in-a-hidden-grid) 🔒 | [Go](problems/shortest-path-in-a-hidden-grid) | Medium |
84+
| <span id="1777">1777</span> | [Product's Price for Each Store](https://leetcode.com/problems/products-price-for-each-store "每家商店的产品价格") 🔒 | [MySQL](problems/products-price-for-each-store) | Easy |
85+
| <span id="1776">1776</span> | [Car Fleet II](https://leetcode.com/problems/car-fleet-ii "车队 II") | [Go](problems/car-fleet-ii) | Hard |
86+
| <span id="1775">1775</span> | [Equal Sum Arrays With Minimum Number of Operations](https://leetcode.com/problems/equal-sum-arrays-with-minimum-number-of-operations "通过最少操作次数使数组的和相等") | [Go](problems/equal-sum-arrays-with-minimum-number-of-operations) | Medium |
87+
| <span id="1774">1774</span> | [Closest Dessert Cost](https://leetcode.com/problems/closest-dessert-cost "最接近目标价格的甜点成本") | [Go](problems/closest-dessert-cost) | Medium |
88+
| <span id="1773">1773</span> | [Count Items Matching a Rule](https://leetcode.com/problems/count-items-matching-a-rule "统计匹配检索规则的物品数量") | [Go](problems/count-items-matching-a-rule) | Easy |
89+
| <span id="1772">1772</span> | [Sort Features by Popularity](https://leetcode.com/problems/sort-features-by-popularity "按受欢迎程度排列功能") 🔒 | [Go](problems/sort-features-by-popularity) | Medium |
7390
| <span id="1771">1771</span> | [Maximize Palindrome Length From Subsequences](https://leetcode.com/problems/maximize-palindrome-length-from-subsequences "由子序列构造的最长回文串的长度") | [Go](problems/maximize-palindrome-length-from-subsequences) | Hard |
7491
| <span id="1770">1770</span> | [Maximum Score from Performing Multiplication Operations](https://leetcode.com/problems/maximum-score-from-performing-multiplication-operations "执行乘法运算的最大分数") | [Go](problems/maximum-score-from-performing-multiplication-operations) | Medium |
7592
| <span id="1769">1769</span> | [Minimum Number of Operations to Move All Balls to Each Box](https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box "移动所有球到每个盒子所需的最小操作数") | [Go](problems/minimum-number-of-operations-to-move-all-balls-to-each-box) | Medium |
@@ -79,13 +96,13 @@ LeetCode Problems' Solutions
7996
| <span id="1765">1765</span> | [Map of Highest Peak](https://leetcode.com/problems/map-of-highest-peak "地图中的最高点") | [Go](problems/map-of-highest-peak) | Medium |
8097
| <span id="1764">1764</span> | [Form Array by Concatenating Subarrays of Another Array](https://leetcode.com/problems/form-array-by-concatenating-subarrays-of-another-array "通过连接另一个数组的子数组得到一个数组") | [Go](problems/form-array-by-concatenating-subarrays-of-another-array) | Medium |
8198
| <span id="1763">1763</span> | [Longest Nice Substring](https://leetcode.com/problems/longest-nice-substring "最长的美好子字符串") | [Go](problems/longest-nice-substring) | Easy |
82-
| <span id="1762">1762</span> | [Buildings With an Ocean View](https://leetcode.com/problems/buildings-with-an-ocean-view) 🔒 | [Go](problems/buildings-with-an-ocean-view) | Medium |
99+
| <span id="1762">1762</span> | [Buildings With an Ocean View](https://leetcode.com/problems/buildings-with-an-ocean-view "能看到海景的建筑物") 🔒 | [Go](problems/buildings-with-an-ocean-view) | Medium |
83100
| <span id="1761">1761</span> | [Minimum Degree of a Connected Trio in a Graph](https://leetcode.com/problems/minimum-degree-of-a-connected-trio-in-a-graph "一个图中连通三元组的最小度数") | [Go](problems/minimum-degree-of-a-connected-trio-in-a-graph) | Hard |
84101
| <span id="1760">1760</span> | [Minimum Limit of Balls in a Bag](https://leetcode.com/problems/minimum-limit-of-balls-in-a-bag "袋子里最少数目的球") | [Go](problems/minimum-limit-of-balls-in-a-bag) | Medium |
85102
| <span id="1759">1759</span> | [Count Number of Homogenous Substrings](https://leetcode.com/problems/count-number-of-homogenous-substrings "统计同构子字符串的数目") | [Go](problems/count-number-of-homogenous-substrings) | Medium |
86103
| <span id="1758">1758</span> | [Minimum Changes To Make Alternating Binary String](https://leetcode.com/problems/minimum-changes-to-make-alternating-binary-string "生成交替二进制字符串的最少操作数") | [Go](problems/minimum-changes-to-make-alternating-binary-string) | Easy |
87-
| <span id="1757">1757</span> | [Recyclable and Low Fat Products](https://leetcode.com/problems/recyclable-and-low-fat-products) 🔒 | [MySQL](problems/recyclable-and-low-fat-products) | Easy |
88-
| <span id="1756">1756</span> | [Design Most Recently Used Queue](https://leetcode.com/problems/design-most-recently-used-queue) 🔒 | [Go](problems/design-most-recently-used-queue) | Medium |
104+
| <span id="1757">1757</span> | [Recyclable and Low Fat Products](https://leetcode.com/problems/recyclable-and-low-fat-products "可回收且低脂的产品") 🔒 | [MySQL](problems/recyclable-and-low-fat-products) | Easy |
105+
| <span id="1756">1756</span> | [Design Most Recently Used Queue](https://leetcode.com/problems/design-most-recently-used-queue "设计最近使用(MRU)队列") 🔒 | [Go](problems/design-most-recently-used-queue) | Medium |
89106
| <span id="1755">1755</span> | [Closest Subsequence Sum](https://leetcode.com/problems/closest-subsequence-sum "最接近目标值的子序列和") | [Go](problems/closest-subsequence-sum) | Hard |
90107
| <span id="1754">1754</span> | [Largest Merge Of Two Strings](https://leetcode.com/problems/largest-merge-of-two-strings "构造字典序最大的合并字符串") | [Go](problems/largest-merge-of-two-strings) | Medium |
91108
| <span id="1753">1753</span> | [Maximum Score From Removing Stones](https://leetcode.com/problems/maximum-score-from-removing-stones "移除石子的最大得分") | [Go](problems/maximum-score-from-removing-stones) | Medium |
@@ -443,7 +460,7 @@ LeetCode Problems' Solutions
443460
| <span id="1401">1401</span> | [Circle and Rectangle Overlapping](https://leetcode.com/problems/circle-and-rectangle-overlapping "圆和矩形是否有重叠") | [Go](problems/circle-and-rectangle-overlapping) | Medium |
444461
| <span id="1400">1400</span> | [Construct K Palindrome Strings](https://leetcode.com/problems/construct-k-palindrome-strings "构造 K 个回文字符串") | [Go](problems/construct-k-palindrome-strings) | Medium |
445462
| <span id="1399">1399</span> | [Count Largest Group](https://leetcode.com/problems/count-largest-group "统计最大组的数目") | [Go](problems/count-largest-group) | Easy |
446-
| <span id="1398">1398</span> | [Customers Who Bought Products A and B but Not C](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c "购买了产品A和产品B却没有购买产品C的顾客") 🔒 | [MySQL](problems/customers-who-bought-products-a-and-b-but-not-c) | Medium |
463+
| <span id="1398">1398</span> | [Customers Who Bought Products A and B but Not C](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c "购买了产品 A 和产品 B 却没有购买产品 C 的顾客") 🔒 | [MySQL](problems/customers-who-bought-products-a-and-b-but-not-c) | Medium |
447464
| <span id="1397">1397</span> | [Find All Good Strings](https://leetcode.com/problems/find-all-good-strings "找到所有好字符串") | [Go](problems/find-all-good-strings) | Hard |
448465
| <span id="1396">1396</span> | [Design Underground System](https://leetcode.com/problems/design-underground-system "设计地铁系统") | [Go](problems/design-underground-system) | Medium |
449466
| <span id="1395">1395</span> | [Count Number of Teams](https://leetcode.com/problems/count-number-of-teams "统计作战单位数") | [Go](problems/count-number-of-teams) | Medium |

Diff for: problems/add-two-numbers/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
### Similar Questions
5656
1. [Multiply Strings](../multiply-strings) (Medium)
5757
1. [Add Binary](../add-binary) (Easy)
58-
1. [Sum of Two Integers](../sum-of-two-integers) (Easy)
58+
1. [Sum of Two Integers](../sum-of-two-integers) (Medium)
5959
1. [Add Strings](../add-strings) (Easy)
6060
1. [Add Two Numbers II](../add-two-numbers-ii) (Medium)
6161
1. [Add to Array-Form of Integer](../add-to-array-form-of-integer) (Easy)

Diff for: problems/all-possible-full-binary-trees/README.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,32 @@
1111

1212
## [894. All Possible Full Binary Trees (Medium)](https://leetcode.com/problems/all-possible-full-binary-trees "所有可能的满二叉树")
1313

14-
<p>A <em>full binary tree</em>&nbsp;is a binary tree where each node has exactly 0 or 2&nbsp;children.</p>
14+
<p>Given an integer <code>n</code>, return <em>a list of all possible <strong>full binary trees</strong> with</em> <code>n</code> <em>nodes</em>. Each node of each tree in the answer must have <code>Node.val == 0</code>.</p>
1515

16-
<p>Return a list of all possible full binary trees with <code>N</code> nodes.&nbsp; Each element of the answer is the root node of one possible tree.</p>
16+
<p>Each element of the answer is the root node of one possible tree. You may return the final list of trees in <strong>any order</strong>.</p>
1717

18-
<p>Each <code>node</code> of each&nbsp;tree in the answer <strong>must</strong> have <code>node.val = 0</code>.</p>
19-
20-
<p>You may return the final list of trees in any order.</p>
18+
<p>A <strong>full binary tree</strong> is a binary tree where each node has exactly <code>0</code> or <code>2</code> children.</p>
2119

2220
<p>&nbsp;</p>
23-
2421
<p><strong>Example 1:</strong></p>
22+
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/22/fivetrees.png" style="width: 700px; height: 400px;" />
23+
<pre>
24+
<strong>Input:</strong> n = 7
25+
<strong>Output:</strong> [[0,0,0,null,null,0,0,null,null,0,0],[0,0,0,null,null,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,null,null,null,null,0,0],[0,0,0,0,0,null,null,0,0]]
26+
</pre>
27+
28+
<p><strong>Example 2:</strong></p>
2529

2630
<pre>
27-
<strong>Input: </strong><span id="example-input-1-1">7</span>
28-
<strong>Output: </strong><span id="example-output-1">[[0,0,0,null,null,0,0,null,null,0,0],[0,0,0,null,null,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,null,null,null,null,0,0],[0,0,0,0,0,null,null,0,0]]</span>
29-
<strong>Explanation:</strong>
30-
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/22/fivetrees.png" style="width: 700px; height: 400px;" />
31+
<strong>Input:</strong> n = 3
32+
<strong>Output:</strong> [[0,0,0]]
3133
</pre>
3234

3335
<p>&nbsp;</p>
34-
35-
<p><strong>Note:</strong></p>
36+
<p><strong>Constraints:</strong></p>
3637

3738
<ul>
38-
<li><code>1 &lt;= N &lt;= 20</code></li>
39+
<li><code>1 &lt;= n &lt;= 20</code></li>
3940
</ul>
4041

4142
### Related Topics

Diff for: problems/arithmetic-slices/README.md

+24-21
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,40 @@
1111

1212
## [413. Arithmetic Slices (Medium)](https://leetcode.com/problems/arithmetic-slices "等差数列划分")
1313

14-
<p>A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.</p>
14+
<p>An integer array is called arithmetic if it consists of <strong>at least three elements</strong> and if the difference between any two consecutive elements is the same.</p>
1515

16-
<p>For example, these are arithmetic sequences:</p>
16+
<ul>
17+
<li>For example, <code>[1,3,5,7,9]</code>, <code>[7,7,7,7]</code>, and <code>[3,-1,-5,-9]</code> are arithmetic sequences.</li>
18+
</ul>
1719

18-
<pre>
19-
1, 3, 5, 7, 9
20-
7, 7, 7, 7
21-
3, -1, -5, -9</pre>
22-
23-
<p>The following sequence is not arithmetic.</p>
20+
<p>Given an integer array <code>nums</code>, return <em>the number of arithmetic <strong>subarrays</strong> of</em> <code>nums</code>.</p>
2421

25-
<pre>
26-
1, 1, 2, 5, 7</pre>
27-
&nbsp;
22+
<p>A <strong>subarray</strong> is a contiguous subsequence of the array.</p>
2823

29-
<p>A zero-indexed array A consisting of N numbers is given. A slice of that array is any pair of integers (P, Q) such that 0 &lt;= P &lt; Q &lt; N.</p>
24+
<p>&nbsp;</p>
25+
<p><strong>Example 1:</strong></p>
3026

31-
<p>A slice (P, Q) of the array A is called arithmetic if the sequence:<br />
32-
A[P], A[P&nbsp;+ 1], ..., A[Q - 1], A[Q] is arithmetic. In particular, this means that P + 1 &lt; Q.</p>
33-
34-
<p>The function should return the number of arithmetic slices in the array A.</p>
35-
&nbsp;
27+
<pre>
28+
<strong>Input:</strong> nums = [1,2,3,4]
29+
<strong>Output:</strong> 3
30+
<strong>Explanation:</strong> We have 3 arithmetic slices in nums: [1, 2, 3], [2, 3, 4] and [1,2,3,4] itself.
31+
</pre>
3632

37-
<p><b>Example:</b></p>
33+
<p><strong>Example 2:</strong></p>
3834

3935
<pre>
40-
A = [1, 2, 3, 4]
41-
42-
return: 3, for 3 arithmetic slices in A: [1, 2, 3], [2, 3, 4] and [1, 2, 3, 4] itself.
36+
<strong>Input:</strong> nums = [1]
37+
<strong>Output:</strong> 0
4338
</pre>
4439

40+
<p>&nbsp;</p>
41+
<p><strong>Constraints:</strong></p>
42+
43+
<ul>
44+
<li><code>1 &lt;= nums.length &lt;= 5000</code></li>
45+
<li><code>-1000 &lt;= nums[i] &lt;= 1000</code></li>
46+
</ul>
47+
4548
### Related Topics
4649
[[Math](../../tag/math/README.md)]
4750
[[Dynamic Programming](../../tag/dynamic-programming/README.md)]

0 commit comments

Comments
 (0)