Skip to content

A: new #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,23 @@ LeetCode Problems' Solutions

| # | Title | Solution | Difficulty |
| :-: | - | - | :-: |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <span id="1783">1783</span> | [Grand Slam Titles](https://leetcode.com/problems/grand-slam-titles) 🔒 | [MySQL](problems/grand-slam-titles) | Medium |
| <span id="1782">1782</span> | [Count Pairs Of Nodes](https://leetcode.com/problems/count-pairs-of-nodes "统计点对的数目") | [Go](problems/count-pairs-of-nodes) | Hard |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <span id="1776">1776</span> | [Car Fleet II](https://leetcode.com/problems/car-fleet-ii "车队 II") | [Go](problems/car-fleet-ii) | Hard |
| <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 |
| <span id="1774">1774</span> | [Closest Dessert Cost](https://leetcode.com/problems/closest-dessert-cost "最接近目标价格的甜点成本") | [Go](problems/closest-dessert-cost) | Medium |
| <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 |
| <span id="1772">1772</span> | [Sort Features by Popularity](https://leetcode.com/problems/sort-features-by-popularity "按受欢迎程度排列功能") 🔒 | [Go](problems/sort-features-by-popularity) | Medium |
| <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 |
| <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 |
| <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 |
Expand All @@ -79,13 +96,13 @@ LeetCode Problems' Solutions
| <span id="1765">1765</span> | [Map of Highest Peak](https://leetcode.com/problems/map-of-highest-peak "地图中的最高点") | [Go](problems/map-of-highest-peak) | Medium |
| <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 |
| <span id="1763">1763</span> | [Longest Nice Substring](https://leetcode.com/problems/longest-nice-substring "最长的美好子字符串") | [Go](problems/longest-nice-substring) | Easy |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <span id="1755">1755</span> | [Closest Subsequence Sum](https://leetcode.com/problems/closest-subsequence-sum "最接近目标值的子序列和") | [Go](problems/closest-subsequence-sum) | Hard |
| <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 |
| <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 |
Expand Down Expand Up @@ -443,7 +460,7 @@ LeetCode Problems' Solutions
| <span id="1401">1401</span> | [Circle and Rectangle Overlapping](https://leetcode.com/problems/circle-and-rectangle-overlapping "圆和矩形是否有重叠") | [Go](problems/circle-and-rectangle-overlapping) | Medium |
| <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 |
| <span id="1399">1399</span> | [Count Largest Group](https://leetcode.com/problems/count-largest-group "统计最大组的数目") | [Go](problems/count-largest-group) | Easy |
| <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 |
| <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 |
| <span id="1397">1397</span> | [Find All Good Strings](https://leetcode.com/problems/find-all-good-strings "找到所有好字符串") | [Go](problems/find-all-good-strings) | Hard |
| <span id="1396">1396</span> | [Design Underground System](https://leetcode.com/problems/design-underground-system "设计地铁系统") | [Go](problems/design-underground-system) | Medium |
| <span id="1395">1395</span> | [Count Number of Teams](https://leetcode.com/problems/count-number-of-teams "统计作战单位数") | [Go](problems/count-number-of-teams) | Medium |
Expand Down
2 changes: 1 addition & 1 deletion problems/add-two-numbers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
### Similar Questions
1. [Multiply Strings](../multiply-strings) (Medium)
1. [Add Binary](../add-binary) (Easy)
1. [Sum of Two Integers](../sum-of-two-integers) (Easy)
1. [Sum of Two Integers](../sum-of-two-integers) (Medium)
1. [Add Strings](../add-strings) (Easy)
1. [Add Two Numbers II](../add-two-numbers-ii) (Medium)
1. [Add to Array-Form of Integer](../add-to-array-form-of-integer) (Easy)
27 changes: 14 additions & 13 deletions problems/all-possible-full-binary-trees/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,32 @@

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

<p>A <em>full binary tree</em>&nbsp;is a binary tree where each node has exactly 0 or 2&nbsp;children.</p>
<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>

<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>
<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>

<p>Each <code>node</code> of each&nbsp;tree in the answer <strong>must</strong> have <code>node.val = 0</code>.</p>

<p>You may return the final list of trees in any order.</p>
<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>

<p>&nbsp;</p>

<p><strong>Example 1:</strong></p>
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/22/fivetrees.png" style="width: 700px; height: 400px;" />
<pre>
<strong>Input:</strong> n = 7
<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]]
</pre>

<p><strong>Example 2:</strong></p>

<pre>
<strong>Input: </strong><span id="example-input-1-1">7</span>
<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>
<strong>Explanation:</strong>
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/22/fivetrees.png" style="width: 700px; height: 400px;" />
<strong>Input:</strong> n = 3
<strong>Output:</strong> [[0,0,0]]
</pre>

<p>&nbsp;</p>

<p><strong>Note:</strong></p>
<p><strong>Constraints:</strong></p>

<ul>
<li><code>1 &lt;= N &lt;= 20</code></li>
<li><code>1 &lt;= n &lt;= 20</code></li>
</ul>

### Related Topics
Expand Down
45 changes: 24 additions & 21 deletions problems/arithmetic-slices/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,40 @@

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

<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>
<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>

<p>For example, these are arithmetic sequences:</p>
<ul>
<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>
</ul>

<pre>
1, 3, 5, 7, 9
7, 7, 7, 7
3, -1, -5, -9</pre>

<p>The following sequence is not arithmetic.</p>
<p>Given an integer array <code>nums</code>, return <em>the number of arithmetic <strong>subarrays</strong> of</em> <code>nums</code>.</p>

<pre>
1, 1, 2, 5, 7</pre>
&nbsp;
<p>A <strong>subarray</strong> is a contiguous subsequence of the array.</p>

<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>
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>

<p>A slice (P, Q) of the array A is called arithmetic if the sequence:<br />
A[P], A[P&nbsp;+ 1], ..., A[Q - 1], A[Q] is arithmetic. In particular, this means that P + 1 &lt; Q.</p>

<p>The function should return the number of arithmetic slices in the array A.</p>
&nbsp;
<pre>
<strong>Input:</strong> nums = [1,2,3,4]
<strong>Output:</strong> 3
<strong>Explanation:</strong> We have 3 arithmetic slices in nums: [1, 2, 3], [2, 3, 4] and [1,2,3,4] itself.
</pre>

<p><b>Example:</b></p>
<p><strong>Example 2:</strong></p>

<pre>
A = [1, 2, 3, 4]

return: 3, for 3 arithmetic slices in A: [1, 2, 3], [2, 3, 4] and [1, 2, 3, 4] itself.
<strong>Input:</strong> nums = [1]
<strong>Output:</strong> 0
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
<li><code>1 &lt;= nums.length &lt;= 5000</code></li>
<li><code>-1000 &lt;= nums[i] &lt;= 1000</code></li>
</ul>

### Related Topics
[[Math](../../tag/math/README.md)]
[[Dynamic Programming](../../tag/dynamic-programming/README.md)]
Expand Down
Loading