You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-6Lines changed: 22 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,22 @@ LeetCode Problems' Solutions
70
70
71
71
| # | Title | Solution | Difficulty |
72
72
| :-: | - | - | :-: |
73
+
| <spanid="1723">1723</span> |[Find Minimum Time to Finish All Jobs](https://leetcode.com/problems/find-minimum-time-to-finish-all-jobs"完成所有工作的最短时间")|[Go](problems/find-minimum-time-to-finish-all-jobs)| Hard |
74
+
| <spanid="1722">1722</span> |[Minimize Hamming Distance After Swap Operations](https://leetcode.com/problems/minimize-hamming-distance-after-swap-operations"执行交换操作后的最小汉明距离")|[Go](problems/minimize-hamming-distance-after-swap-operations)| Medium |
75
+
| <spanid="1721">1721</span> |[Swapping Nodes in a Linked List](https://leetcode.com/problems/swapping-nodes-in-a-linked-list"交换链表中的节点")|[Go](problems/swapping-nodes-in-a-linked-list)| Medium |
| <spanid="1719">1719</span> |[Number Of Ways To Reconstruct A Tree](https://leetcode.com/problems/number-of-ways-to-reconstruct-a-tree"重构一棵树的方案数")|[Go](problems/number-of-ways-to-reconstruct-a-tree)| Hard |
78
+
| <spanid="1718">1718</span> |[Construct the Lexicographically Largest Valid Sequence](https://leetcode.com/problems/construct-the-lexicographically-largest-valid-sequence"构建字典序最大的可行序列")|[Go](problems/construct-the-lexicographically-largest-valid-sequence)| Medium |
79
+
| <spanid="1717">1717</span> |[Maximum Score From Removing Substrings](https://leetcode.com/problems/maximum-score-from-removing-substrings"删除子字符串的最大得分")|[Go](problems/maximum-score-from-removing-substrings)| Medium |
80
+
| <spanid="1716">1716</span> |[Calculate Money in Leetcode Bank](https://leetcode.com/problems/calculate-money-in-leetcode-bank"计算力扣银行的钱")|[Go](problems/calculate-money-in-leetcode-bank)| Easy |
81
+
| <spanid="1715">1715</span> |[Count Apples and Oranges](https://leetcode.com/problems/count-apples-and-oranges) 🔒 |[MySQL](problems/count-apples-and-oranges)| Medium |
82
+
| <spanid="1714">1714</span> |[Sum Of Special Evenly-Spaced Elements In Array](https://leetcode.com/problems/sum-of-special-evenly-spaced-elements-in-array) 🔒 |[Go](problems/sum-of-special-evenly-spaced-elements-in-array)| Hard |
83
+
| <spanid="1713">1713</span> |[Minimum Operations to Make a Subsequence](https://leetcode.com/problems/minimum-operations-to-make-a-subsequence"得到子序列的最少操作次数")|[Go](problems/minimum-operations-to-make-a-subsequence)| Hard |
84
+
| <spanid="1712">1712</span> |[Ways to Split Array Into Three Subarrays](https://leetcode.com/problems/ways-to-split-array-into-three-subarrays"将数组分成三个子数组的方案数")|[Go](problems/ways-to-split-array-into-three-subarrays)| Medium |
85
+
| <spanid="1711">1711</span> |[Count Good Meals](https://leetcode.com/problems/count-good-meals"大餐计数")|[Go](problems/count-good-meals)| Medium |
86
+
| <spanid="1710">1710</span> |[Maximum Units on a Truck](https://leetcode.com/problems/maximum-units-on-a-truck"卡车上的最大单元数")|[Go](problems/maximum-units-on-a-truck)| Easy |
87
+
| <spanid="1709">1709</span> |[Biggest Window Between Visits](https://leetcode.com/problems/biggest-window-between-visits) 🔒 |[MySQL](problems/biggest-window-between-visits)| Medium |
| <spanid="1707">1707</span> |[Maximum XOR With an Element From Array](https://leetcode.com/problems/maximum-xor-with-an-element-from-array"与数组中元素的最大异或值")|[Go](problems/maximum-xor-with-an-element-from-array)| Hard |
74
90
| <spanid="1706">1706</span> |[Where Will the Ball Fall](https://leetcode.com/problems/where-will-the-ball-fall"球会落何处")|[Go](problems/where-will-the-ball-fall)| Medium |
75
91
| <spanid="1705">1705</span> |[Maximum Number of Eaten Apples](https://leetcode.com/problems/maximum-number-of-eaten-apples"吃苹果的最大数目")|[Go](problems/maximum-number-of-eaten-apples)| Medium |
@@ -79,13 +95,13 @@ LeetCode Problems' Solutions
79
95
| <spanid="1701">1701</span> |[Average Waiting Time](https://leetcode.com/problems/average-waiting-time"平均等待时间")|[Go](problems/average-waiting-time)| Medium |
80
96
| <spanid="1700">1700</span> |[Number of Students Unable to Eat Lunch](https://leetcode.com/problems/number-of-students-unable-to-eat-lunch"无法吃午餐的学生数量")|[Go](problems/number-of-students-unable-to-eat-lunch)| Easy |
81
97
| <spanid="1699">1699</span> |[Number of Calls Between Two Persons](https://leetcode.com/problems/number-of-calls-between-two-persons) 🔒 |[MySQL](problems/number-of-calls-between-two-persons)| Medium |
82
-
| <spanid="1698">1698</span> |[Number of Distinct Substrings in a String](https://leetcode.com/problems/number-of-distinct-substrings-in-a-string) 🔒 |[Go](problems/number-of-distinct-substrings-in-a-string)| Medium |
98
+
| <spanid="1698">1698</span> |[Number of Distinct Substrings in a String](https://leetcode.com/problems/number-of-distinct-substrings-in-a-string"字符串的不同子字符串个数") 🔒 |[Go](problems/number-of-distinct-substrings-in-a-string)| Medium |
83
99
| <spanid="1697">1697</span> |[Checking Existence of Edge Length Limited Paths](https://leetcode.com/problems/checking-existence-of-edge-length-limited-paths"检查边长度限制的路径是否存在")|[Go](problems/checking-existence-of-edge-length-limited-paths)| Hard |
84
100
| <spanid="1696">1696</span> |[Jump Game VI](https://leetcode.com/problems/jump-game-vi"跳跃游戏 VI")|[Go](problems/jump-game-vi)| Medium |
85
101
| <spanid="1695">1695</span> |[Maximum Erasure Value](https://leetcode.com/problems/maximum-erasure-value"删除子数组的最大得分")|[Go](problems/maximum-erasure-value)| Medium |
| <spanid="1693">1693</span> |[Daily Leads and Partners](https://leetcode.com/problems/daily-leads-and-partners) 🔒 |[MySQL](problems/daily-leads-and-partners)| Easy |
88
-
| <spanid="1692">1692</span> |[Count Ways to Distribute Candies](https://leetcode.com/problems/count-ways-to-distribute-candies) 🔒 |[Go](problems/count-ways-to-distribute-candies)| Hard |
103
+
| <spanid="1693">1693</span> |[Daily Leads and Partners](https://leetcode.com/problems/daily-leads-and-partners"每天的领导和合伙人") 🔒 |[MySQL](problems/daily-leads-and-partners)| Easy |
104
+
| <spanid="1692">1692</span> |[Count Ways to Distribute Candies](https://leetcode.com/problems/count-ways-to-distribute-candies"计算分配糖果的不同方式") 🔒 |[Go](problems/count-ways-to-distribute-candies)| Hard |
89
105
| <spanid="1691">1691</span> |[Maximum Height by Stacking Cuboids](https://leetcode.com/problems/maximum-height-by-stacking-cuboids"堆叠长方体的最大高度")|[Go](problems/maximum-height-by-stacking-cuboids)| Hard |
90
106
| <spanid="1690">1690</span> |[Stone Game VII](https://leetcode.com/problems/stone-game-vii"石子游戏 VII")|[Go](problems/stone-game-vii)| Medium |
91
107
| <spanid="1689">1689</span> |[Partitioning Into Minimum Number Of Deci-Binary Numbers](https://leetcode.com/problems/partitioning-into-minimum-number-of-deci-binary-numbers"十-二进制数的最少数目")|[Go](problems/partitioning-into-minimum-number-of-deci-binary-numbers)| Medium |
@@ -95,13 +111,13 @@ LeetCode Problems' Solutions
95
111
| <spanid="1685">1685</span> |[Sum of Absolute Differences in a Sorted Array](https://leetcode.com/problems/sum-of-absolute-differences-in-a-sorted-array"有序数组中差绝对值之和")|[Go](problems/sum-of-absolute-differences-in-a-sorted-array)| Medium |
96
112
| <spanid="1684">1684</span> |[Count the Number of Consistent Strings](https://leetcode.com/problems/count-the-number-of-consistent-strings"统计一致字符串的数目")|[Go](problems/count-the-number-of-consistent-strings)| Easy |
| <spanid="1681">1681</span> |[Minimum Incompatibility](https://leetcode.com/problems/minimum-incompatibility"最小不兼容性")|[Go](problems/minimum-incompatibility)| Hard |
100
116
| <spanid="1680">1680</span> |[Concatenation of Consecutive Binary Numbers](https://leetcode.com/problems/concatenation-of-consecutive-binary-numbers"连接连续二进制数字")|[Go](problems/concatenation-of-consecutive-binary-numbers)| Medium |
101
117
| <spanid="1679">1679</span> |[Max Number of K-Sum Pairs](https://leetcode.com/problems/max-number-of-k-sum-pairs"K 和数对的最大数目")|[Go](problems/max-number-of-k-sum-pairs)| Medium |
| <spanid="1677">1677</span> |[Product's Worth Over Invoices](https://leetcode.com/problems/products-worth-over-invoices) 🔒 |[MySQL](problems/products-worth-over-invoices)| Easy |
104
-
| <spanid="1676">1676</span> |[Lowest Common Ancestor of a Binary Tree IV](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree-iv) 🔒 |[Go](problems/lowest-common-ancestor-of-a-binary-tree-iv)| Medium |
120
+
| <spanid="1676">1676</span> |[Lowest Common Ancestor of a Binary Tree IV](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree-iv"二叉树的最近公共祖先 IV") 🔒 |[Go](problems/lowest-common-ancestor-of-a-binary-tree-iv)| Medium |
105
121
| <spanid="1675">1675</span> |[Minimize Deviation in Array](https://leetcode.com/problems/minimize-deviation-in-array"数组的最小偏移量")|[Go](problems/minimize-deviation-in-array)| Hard |
106
122
| <spanid="1674">1674</span> |[Minimum Moves to Make Array Complementary](https://leetcode.com/problems/minimum-moves-to-make-array-complementary"使数组互补的最少操作次数")|[Go](problems/minimum-moves-to-make-array-complementary)| Medium |
107
123
| <spanid="1673">1673</span> |[Find the Most Competitive Subsequence](https://leetcode.com/problems/find-the-most-competitive-subsequence"找出最具竞争力的子序列")|[Go](problems/find-the-most-competitive-subsequence)| Medium |
@@ -110,7 +126,7 @@ LeetCode Problems' Solutions
110
126
| <spanid="1670">1670</span> |[Design Front Middle Back Queue](https://leetcode.com/problems/design-front-middle-back-queue"设计前中后队列")|[Go](problems/design-front-middle-back-queue)| Medium |
111
127
| <spanid="1669">1669</span> |[Merge In Between Linked Lists](https://leetcode.com/problems/merge-in-between-linked-lists"合并两个链表")|[Go](problems/merge-in-between-linked-lists)| Medium |
| <spanid="1667">1667</span> |[Fix Names in a Table](https://leetcode.com/problems/fix-names-in-a-table) 🔒 |[MySQL](problems/fix-names-in-a-table)| Easy |
129
+
| <spanid="1667">1667</span> |[Fix Names in a Table](https://leetcode.com/problems/fix-names-in-a-table"修复表中的名字") 🔒 |[MySQL](problems/fix-names-in-a-table)| Easy |
114
130
| <spanid="1666">1666</span> |[Change the Root of a Binary Tree](https://leetcode.com/problems/change-the-root-of-a-binary-tree"改变二叉树的根节点") 🔒 |[Go](problems/change-the-root-of-a-binary-tree)| Medium |
115
131
| <spanid="1665">1665</span> |[Minimum Initial Energy to Finish Tasks](https://leetcode.com/problems/minimum-initial-energy-to-finish-tasks"完成所有任务的最少初始能量")|[Go](problems/minimum-initial-energy-to-finish-tasks)| Hard |
116
132
| <spanid="1664">1664</span> |[Ways to Make a Fair Array](https://leetcode.com/problems/ways-to-make-a-fair-array"生成平衡数组的方案数")|[Go](problems/ways-to-make-a-fair-array)| Medium |
Copy file name to clipboardExpand all lines: problems/3sum-with-multiplicity/README.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -11,18 +11,18 @@
11
11
12
12
## [923. 3Sum With Multiplicity (Medium)](https://leetcode.com/problems/3sum-with-multiplicity"三数之和的多种可能")
13
13
14
-
<p>Given an integer array <code>A</code>, and an integer <code>target</code>, return the number of tuples <code>i, j, k</code> such that <code>i < j < k</code> and <code>A[i] + A[j] + A[k] == target</code>.</p>
14
+
<p>Given an integer array <code>arr</code>, and an integer <code>target</code>, return the number oftuples<code>i, j, k</code> such that <code>i < j < k</code> and<code>arr[i] + arr[j] + arr[k] == target</code>.</p>
15
15
16
-
<p>As the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
16
+
<p>As the answer can be very large, return it <strong>modulo</strong><code>10<sup>9</sup> + 7</code>.</p>
17
17
18
18
<p> </p>
19
19
<p><strong>Example 1:</strong></p>
20
20
21
21
<pre>
22
-
<strong>Input:</strong> A = [1,1,2,2,3,3,4,4,5,5], target = 8
<p>Suppose you have <b>N</b> integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these <b>N</b> numbers successfully if one of the following is true for the i<sub>th</sub> position (1 <= i <= N) in this array:</p>
14
+
<p>Suppose you have <code>n</code> integers labeled <code>1</code> through <code>n</code>. A permutation of those <code>n</code> integers <code>perm</code> (<strong>1-indexed</strong>) is considered a <strong>beautiful arrangement</strong> if for every <code>i</code> (<code>1 <= i <= n</code>), <strong>either</strong> of the following is true:</p>
15
15
16
-
<ol>
17
-
<li>The number at the i<sub>th</sub> position is divisible by <b>i</b>.</li>
18
-
<li><b>i</b> is divisible by the number at the i<sub>th</sub> position.</li>
19
-
</ol>
16
+
<ul>
17
+
<li><code>perm[i]</code> is divisible by <code>i</code>.</li>
18
+
<li><code>i</code> is divisible by <code>perm[i]</code>.</li>
19
+
</ul>
20
20
21
-
<p> </p>
22
-
23
-
<p>Now given N, how many beautiful arrangements can you construct?</p>
21
+
<p>Given an integer <code>n</code>, return <em>the <strong>number</strong> of the <strong>beautiful arrangements</strong> that you can construct</em>.</p>
24
22
25
-
<p><b>Example 1:</b></p>
23
+
<p> </p>
24
+
<p><strong>Example 1:</strong></p>
26
25
27
26
<pre>
28
-
<b>Input:</b> 2
29
-
<b>Output:</b> 2
27
+
<strong>Input:</strong> n = 2
28
+
<strong>Output:</strong> 2
30
29
<b>Explanation:</b>
30
+
The first beautiful arrangement is [1,2]:
31
+
- perm[1] = 1 is divisible by i = 1
32
+
- perm[2] = 2 is divisible by i = 2
33
+
The second beautiful arrangement is [2,1]:
34
+
- perm[1] = 2 is divisible by i = 1
35
+
- i = 2 is divisible by perm[2] = 1
36
+
</pre>
31
37
32
-
The first beautiful arrangement is [1, 2]:
33
-
34
-
Number at the 1st position (i=1) is 1, and 1 is divisible by i (i=1).
35
-
36
-
Number at the 2nd position (i=2) is 2, and 2 is divisible by i (i=2).
37
-
38
-
The second beautiful arrangement is [2, 1]:
39
-
40
-
Number at the 1st position (i=1) is 2, and 2 is divisible by i (i=1).
38
+
<p><strong>Example 2:</strong></p>
41
39
42
-
Number at the 2nd position (i=2) is 1, and i (i=2) is divisible by 1.
40
+
<pre>
41
+
<strong>Input:</strong> n = 1
42
+
<strong>Output:</strong> 1
43
43
</pre>
44
44
45
45
<p> </p>
46
+
<p><strong>Constraints:</strong></p>
46
47
47
-
<p><b>Note:</b></p>
48
-
49
-
<ol>
50
-
<li><b>N</b> is a positive integer and will not exceed 15.</li>
0 commit comments