Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 20e5fcc

Browse files
author
Shuo
authored
Merge pull request #842 from openset/develop
A: new
2 parents 2a95b94 + 0dfdaa8 commit 20e5fcc

File tree

218 files changed

+3810
-1565
lines changed

Some content is hidden

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

218 files changed

+3810
-1565
lines changed

‎README.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,44 @@ LeetCode Problems' Solutions
7878

7979
| # | Title | Solution | Difficulty |
8080
| :-: | - | - | :-: |
81+
| <span id="1988">1988</span> | [Find Cutoff Score for Each School](https://leetcode.com/problems/find-cutoff-score-for-each-school) 🔒 | [MySQL](problems/find-cutoff-score-for-each-school) | Medium |
82+
| <span id="1987">1987</span> | [Number of Unique Good Subsequences](https://leetcode.com/problems/number-of-unique-good-subsequences "不同的好子序列数目") | [Go](problems/number-of-unique-good-subsequences) | Hard |
83+
| <span id="1986">1986</span> | [Minimum Number of Work Sessions to Finish the Tasks](https://leetcode.com/problems/minimum-number-of-work-sessions-to-finish-the-tasks "完成任务的最少工作时间段") | [Go](problems/minimum-number-of-work-sessions-to-finish-the-tasks) | Medium |
84+
| <span id="1985">1985</span> | [Find the Kth Largest Integer in the Array](https://leetcode.com/problems/find-the-kth-largest-integer-in-the-array "找出数组中的第 K 大整数") | [Go](problems/find-the-kth-largest-integer-in-the-array) | Medium |
85+
| <span id="1984">1984</span> | [Minimum Difference Between Highest and Lowest of K Scores](https://leetcode.com/problems/minimum-difference-between-highest-and-lowest-of-k-scores "学生分数的最小差值") | [Go](problems/minimum-difference-between-highest-and-lowest-of-k-scores) | Easy |
86+
| <span id="1983">1983</span> | [Widest Pair of Indices With Equal Range Sum](https://leetcode.com/problems/widest-pair-of-indices-with-equal-range-sum) 🔒 | [Go](problems/widest-pair-of-indices-with-equal-range-sum) | Medium |
87+
| <span id="1982">1982</span> | [Find Array Given Subset Sums](https://leetcode.com/problems/find-array-given-subset-sums "从子集的和还原数组") | [Go](problems/find-array-given-subset-sums) | Hard |
88+
| <span id="1981">1981</span> | [Minimize the Difference Between Target and Chosen Elements](https://leetcode.com/problems/minimize-the-difference-between-target-and-chosen-elements "最小化目标值与所选元素的差") | [Go](problems/minimize-the-difference-between-target-and-chosen-elements) | Medium |
89+
| <span id="1980">1980</span> | [Find Unique Binary String](https://leetcode.com/problems/find-unique-binary-string "找出不同的二进制字符串") | [Go](problems/find-unique-binary-string) | Medium |
90+
| <span id="1979">1979</span> | [Find Greatest Common Divisor of Array](https://leetcode.com/problems/find-greatest-common-divisor-of-array "找出数组的最大公约数") | [Go](problems/find-greatest-common-divisor-of-array) | Easy |
91+
| <span id="1978">1978</span> | [Employees Whose Manager Left the Company](https://leetcode.com/problems/employees-whose-manager-left-the-company) 🔒 | [MySQL](problems/employees-whose-manager-left-the-company) | Easy |
92+
| <span id="1977">1977</span> | [Number of Ways to Separate Numbers](https://leetcode.com/problems/number-of-ways-to-separate-numbers "划分数字的方案数") | [Go](problems/number-of-ways-to-separate-numbers) | Hard |
93+
| <span id="1976">1976</span> | [Number of Ways to Arrive at Destination](https://leetcode.com/problems/number-of-ways-to-arrive-at-destination "到达目的地的方案数") | [Go](problems/number-of-ways-to-arrive-at-destination) | Medium |
94+
| <span id="1975">1975</span> | [Maximum Matrix Sum](https://leetcode.com/problems/maximum-matrix-sum "最大方阵和") | [Go](problems/maximum-matrix-sum) | Medium |
95+
| <span id="1974">1974</span> | [Minimum Time to Type Word Using Special Typewriter](https://leetcode.com/problems/minimum-time-to-type-word-using-special-typewriter "使用特殊打字机键入单词的最少时间") | [Go](problems/minimum-time-to-type-word-using-special-typewriter) | Easy |
96+
| <span id="1973">1973</span> | [Count Nodes Equal to Sum of Descendants](https://leetcode.com/problems/count-nodes-equal-to-sum-of-descendants) 🔒 | [Go](problems/count-nodes-equal-to-sum-of-descendants) | Medium |
97+
| <span id="1972">1972</span> | [First and Last Call On the Same Day](https://leetcode.com/problems/first-and-last-call-on-the-same-day) 🔒 | [MySQL](problems/first-and-last-call-on-the-same-day) | Hard |
98+
| <span id="1971">1971</span> | [Find if Path Exists in Graph](https://leetcode.com/problems/find-if-path-exists-in-graph) | [Go](problems/find-if-path-exists-in-graph) | Easy |
99+
| <span id="1970">1970</span> | [Last Day Where You Can Still Cross](https://leetcode.com/problems/last-day-where-you-can-still-cross "你能穿过矩阵的最后一天") | [Go](problems/last-day-where-you-can-still-cross) | Hard |
100+
| <span id="1969">1969</span> | [Minimum Non-Zero Product of the Array Elements](https://leetcode.com/problems/minimum-non-zero-product-of-the-array-elements "数组元素的最小非零乘积") | [Go](problems/minimum-non-zero-product-of-the-array-elements) | Medium |
101+
| <span id="1968">1968</span> | [Array With Elements Not Equal to Average of Neighbors](https://leetcode.com/problems/array-with-elements-not-equal-to-average-of-neighbors "构造元素不等于两相邻元素平均值的数组") | [Go](problems/array-with-elements-not-equal-to-average-of-neighbors) | Medium |
102+
| <span id="1967">1967</span> | [Number of Strings That Appear as Substrings in Word](https://leetcode.com/problems/number-of-strings-that-appear-as-substrings-in-word "作为子字符串出现在单词中的字符串数目") | [Go](problems/number-of-strings-that-appear-as-substrings-in-word) | Easy |
103+
| <span id="1966">1966</span> | [Binary Searchable Numbers in an Unsorted Array](https://leetcode.com/problems/binary-searchable-numbers-in-an-unsorted-array) 🔒 | [Go](problems/binary-searchable-numbers-in-an-unsorted-array) | Medium |
104+
| <span id="1965">1965</span> | [Employees With Missing Information](https://leetcode.com/problems/employees-with-missing-information) 🔒 | [MySQL](problems/employees-with-missing-information) | Easy |
105+
| <span id="1964">1964</span> | [Find the Longest Valid Obstacle Course at Each Position](https://leetcode.com/problems/find-the-longest-valid-obstacle-course-at-each-position "找出到每个位置为止最长的有效障碍赛跑路线") | [Go](problems/find-the-longest-valid-obstacle-course-at-each-position) | Hard |
106+
| <span id="1963">1963</span> | [Minimum Number of Swaps to Make the String Balanced](https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced "使字符串平衡的最小交换次数") | [Go](problems/minimum-number-of-swaps-to-make-the-string-balanced) | Medium |
107+
| <span id="1962">1962</span> | [Remove Stones to Minimize the Total](https://leetcode.com/problems/remove-stones-to-minimize-the-total "移除石子使总数最小") | [Go](problems/remove-stones-to-minimize-the-total) | Medium |
108+
| <span id="1961">1961</span> | [Check If String Is a Prefix of Array](https://leetcode.com/problems/check-if-string-is-a-prefix-of-array "检查字符串是否为数组前缀") | [Go](problems/check-if-string-is-a-prefix-of-array) | Easy |
109+
| <span id="1960">1960</span> | [Maximum Product of the Length of Two Palindromic Substrings](https://leetcode.com/problems/maximum-product-of-the-length-of-two-palindromic-substrings "两个回文子字符串长度的最大乘积") | [Go](problems/maximum-product-of-the-length-of-two-palindromic-substrings) | Hard |
110+
| <span id="1959">1959</span> | [Minimum Total Space Wasted With K Resizing Operations](https://leetcode.com/problems/minimum-total-space-wasted-with-k-resizing-operations "K 次调整数组大小浪费的最小总空间") | [Go](problems/minimum-total-space-wasted-with-k-resizing-operations) | Medium |
111+
| <span id="1958">1958</span> | [Check if Move is Legal](https://leetcode.com/problems/check-if-move-is-legal "检查操作是否合法") | [Go](problems/check-if-move-is-legal) | Medium |
112+
| <span id="1957">1957</span> | [Delete Characters to Make Fancy String](https://leetcode.com/problems/delete-characters-to-make-fancy-string "删除字符使字符串变好") | [Go](problems/delete-characters-to-make-fancy-string) | Easy |
113+
| <span id="1956">1956</span> | [Minimum Time For K Virus Variants to Spread](https://leetcode.com/problems/minimum-time-for-k-virus-variants-to-spread "感染 K 种病毒所需的最短时间") 🔒 | [Go](problems/minimum-time-for-k-virus-variants-to-spread) | Hard |
81114
| <span id="1955">1955</span> | [Count Number of Special Subsequences](https://leetcode.com/problems/count-number-of-special-subsequences "统计特殊子序列的数目") | [Go](problems/count-number-of-special-subsequences) | Hard |
82115
| <span id="1954">1954</span> | [Minimum Garden Perimeter to Collect Enough Apples](https://leetcode.com/problems/minimum-garden-perimeter-to-collect-enough-apples "收集足够苹果的最小花园周长") | [Go](problems/minimum-garden-perimeter-to-collect-enough-apples) | Medium |
83116
| <span id="1953">1953</span> | [Maximum Number of Weeks for Which You Can Work](https://leetcode.com/problems/maximum-number-of-weeks-for-which-you-can-work "你可以工作的最大周数") | [Go](problems/maximum-number-of-weeks-for-which-you-can-work) | Medium |
84117
| <span id="1952">1952</span> | [Three Divisors](https://leetcode.com/problems/three-divisors "三除数") | [Go](problems/three-divisors) | Easy |
85-
| <span id="1951">1951</span> | [All the Pairs With the Maximum Number of Common Followers](https://leetcode.com/problems/all-the-pairs-with-the-maximum-number-of-common-followers) 🔒 | [MySQL](problems/all-the-pairs-with-the-maximum-number-of-common-followers) | Medium |
118+
| <span id="1951">1951</span> | [All the Pairs With the Maximum Number of Common Followers](https://leetcode.com/problems/all-the-pairs-with-the-maximum-number-of-common-followers"查询具有最多共同关注者的所有两两结对组") 🔒 | [MySQL](problems/all-the-pairs-with-the-maximum-number-of-common-followers) | Medium |
86119
| <span id="1950">1950</span> | [Maximum of Minimum Values in All Subarrays](https://leetcode.com/problems/maximum-of-minimum-values-in-all-subarrays "所有子数组最小值中的最大值") 🔒 | [Go](problems/maximum-of-minimum-values-in-all-subarrays) | Medium |
87120
| <span id="1949">1949</span> | [Strong Friendship](https://leetcode.com/problems/strong-friendship) 🔒 | [MySQL](problems/strong-friendship) | Medium |
88121
| <span id="1948">1948</span> | [Delete Duplicate Folders in System](https://leetcode.com/problems/delete-duplicate-folders-in-system "删除系统中的重复文件夹") | [Go](problems/delete-duplicate-folders-in-system) | Hard |
@@ -115,7 +148,7 @@ LeetCode Problems' Solutions
115148
| <span id="1921">1921</span> | [Eliminate Maximum Number of Monsters](https://leetcode.com/problems/eliminate-maximum-number-of-monsters "消灭怪物的最大数量") | [Go](problems/eliminate-maximum-number-of-monsters) | Medium |
116149
| <span id="1920">1920</span> | [Build Array from Permutation](https://leetcode.com/problems/build-array-from-permutation "基于排列构建数组") | [Go](problems/build-array-from-permutation) | Easy |
117150
| <span id="1919">1919</span> | [Leetcodify Similar Friends](https://leetcode.com/problems/leetcodify-similar-friends "兴趣相同的朋友") 🔒 | [MySQL](problems/leetcodify-similar-friends) | Hard |
118-
| <span id="1918">1918</span> | [Kth Smallest Subarray Sum](https://leetcode.com/problems/kth-smallest-subarray-sum) 🔒 | [Go](problems/kth-smallest-subarray-sum) | Medium |
151+
| <span id="1918">1918</span> | [Kth Smallest Subarray Sum](https://leetcode.com/problems/kth-smallest-subarray-sum"第 K 小的子序列和") 🔒 | [Go](problems/kth-smallest-subarray-sum) | Medium |
119152
| <span id="1917">1917</span> | [Leetcodify Friends Recommendations](https://leetcode.com/problems/leetcodify-friends-recommendations) 🔒 | [MySQL](problems/leetcodify-friends-recommendations) | Hard |
120153
| <span id="1916">1916</span> | [Count Ways to Build Rooms in an Ant Colony](https://leetcode.com/problems/count-ways-to-build-rooms-in-an-ant-colony "统计为蚁群构筑房间的不同顺序") | [Go](problems/count-ways-to-build-rooms-in-an-ant-colony) | Hard |
121154
| <span id="1915">1915</span> | [Number of Wonderful Substrings](https://leetcode.com/problems/number-of-wonderful-substrings "最美子字符串的数目") | [Go](problems/number-of-wonderful-substrings) | Medium |
@@ -125,7 +158,7 @@ LeetCode Problems' Solutions
125158
| <span id="1911">1911</span> | [Maximum Alternating Subsequence Sum](https://leetcode.com/problems/maximum-alternating-subsequence-sum "最大子序列交替和") | [Go](problems/maximum-alternating-subsequence-sum) | Medium |
126159
| <span id="1910">1910</span> | [Remove All Occurrences of a Substring](https://leetcode.com/problems/remove-all-occurrences-of-a-substring "删除一个字符串中所有出现的给定子字符串") | [Go](problems/remove-all-occurrences-of-a-substring) | Medium |
127160
| <span id="1909">1909</span> | [Remove One Element to Make the Array Strictly Increasing](https://leetcode.com/problems/remove-one-element-to-make-the-array-strictly-increasing "删除一个元素使数组严格递增") | [Go](problems/remove-one-element-to-make-the-array-strictly-increasing) | Easy |
128-
| <span id="1908">1908</span> | [Game of Nim](https://leetcode.com/problems/game-of-nim) 🔒 | [Go](problems/game-of-nim) | Medium |
161+
| <span id="1908">1908</span> | [Game of Nim](https://leetcode.com/problems/game-of-nim"Nim 游戏 II") 🔒 | [Go](problems/game-of-nim) | Medium |
129162
| <span id="1907">1907</span> | [Count Salary Categories](https://leetcode.com/problems/count-salary-categories "按分类统计薪水") 🔒 | [MySQL](problems/count-salary-categories) | Medium |
130163
| <span id="1906">1906</span> | [Minimum Absolute Difference Queries](https://leetcode.com/problems/minimum-absolute-difference-queries "查询差绝对值的最小值") | [Go](problems/minimum-absolute-difference-queries) | Medium |
131164
| <span id="1905">1905</span> | [Count Sub Islands](https://leetcode.com/problems/count-sub-islands "统计子岛屿") | [Go](problems/count-sub-islands) | Medium |

‎problems/3sum-closest/README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
## [16. 3Sum Closest (Medium)](https://leetcode.com/problems/3sum-closest "最接近的三数之和")
1313

14-
<p>Given an array <code>nums</code> of <em>n</em> integers and an integer <code>target</code>, find three integers in <code>nums</code>&nbsp;such that the sum is closest to&nbsp;<code>target</code>. Return the sum of the three integers. You may assume that each input would have exactly one solution.</p>
14+
<p>Given an integer array <code>nums</code> of length <code>n</code> and an integer <code>target</code>, find three integers in <code>nums</code> such that the sum is closest to <code>target</code>.</p>
15+
16+
<p>Return <em>the sum of the three integers</em>.</p>
17+
18+
<p>You may assume that each input would have exactly one solution.</p>
1519

1620
<p>&nbsp;</p>
1721
<p><strong>Example 1:</strong></p>
@@ -22,13 +26,20 @@
2226
<strong>Explanation:</strong> The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).
2327
</pre>
2428

29+
<p><strong>Example 2:</strong></p>
30+
31+
<pre>
32+
<strong>Input:</strong> nums = [0,0,0], target = 1
33+
<strong>Output:</strong> 0
34+
</pre>
35+
2536
<p>&nbsp;</p>
2637
<p><strong>Constraints:</strong></p>
2738

2839
<ul>
29-
<li><code>3 &lt;= nums.length &lt;= 10^3</code></li>
30-
<li><code>-10^3&nbsp;&lt;= nums[i]&nbsp;&lt;= 10^3</code></li>
31-
<li><code>-10^4&nbsp;&lt;= target&nbsp;&lt;= 10^4</code></li>
40+
<li><code>3 &lt;= nums.length &lt;= 1000</code></li>
41+
<li><code>-1000 &lt;= nums[i] &lt;= 1000</code></li>
42+
<li><code>-10<sup>4</sup> &lt;= target &lt;= 10<sup>4</sup></code></li>
3243
</ul>
3344

3445
### Related Topics

‎problems/all-the-pairs-with-the-maximum-number-of-common-followers/README.md

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

1010
[Next >](../three-divisors "Three Divisors")
1111

12-
## [1951. All the Pairs With the Maximum Number of Common Followers (Medium)](https://leetcode.com/problems/all-the-pairs-with-the-maximum-number-of-common-followers "")
12+
## [1951. All the Pairs With the Maximum Number of Common Followers (Medium)](https://leetcode.com/problems/all-the-pairs-with-the-maximum-number-of-common-followers "查询具有最多共同关注者的所有两两结对组")
1313

1414

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /