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

Browse files
committed
feat: add new lc problems and solutions
1 parent 24b6349 commit 36fb36c

File tree

85 files changed

+3904
-104
lines changed

Some content is hidden

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

85 files changed

+3904
-104
lines changed

‎solution/0100-0199/0182.Duplicate Emails/README.md‎

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,50 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>编写一个 SQL 查询,查找&nbsp;<code>Person</code> 表中所有重复的电子邮箱。</p>
9+
<p><meta charset="UTF-8" /></p>
10+
11+
<p>表:&nbsp;<code>Person</code></p>
12+
13+
<pre>
14+
+-------------+---------+
15+
| Column Name | Type |
16+
+-------------+---------+
17+
| id | int |
18+
| email | varchar |
19+
+-------------+---------+
20+
id 是该表的主键列。
21+
此表的每一行都包含一封电子邮件。电子邮件不包含大写字母。
22+
</pre>
23+
24+
<p>&nbsp;</p>
25+
26+
<p>编写一个 SQL 查询来报告所有重复的电子邮件。 请注意,可以保证电子邮件字段不为 NULL。</p>
27+
28+
<p>以&nbsp;<strong>任意顺序&nbsp;</strong>返回结果表。</p>
1029

11-
<p><strong>示例:</strong></p>
30+
<p>查询结果格式如下例。</p>
1231

13-
<pre>+----+---------+
14-
| Id | Email |
32+
<p>&nbsp;</p>
33+
34+
<p><strong>示例&nbsp;1:</strong></p>
35+
36+
<pre>
37+
<strong>输入:</strong>
38+
Person 表:
39+
+----+---------+
40+
| id | email |
1541
+----+---------+
1642
| 1 | a@b.com |
1743
| 2 | c@d.com |
1844
| 3 | a@b.com |
1945
+----+---------+
20-
</pre>
21-
22-
<p>根据以上输入,你的查询应返回以下结果:</p>
23-
24-
<pre>+---------+
46+
<strong>输出:</strong>
47+
+---------+
2548
| Email |
2649
+---------+
2750
| a@b.com |
2851
+---------+
29-
</pre>
30-
31-
<p><strong>说明:</strong>所有电子邮箱都是小写字母。</p>
52+
<strong>解释:</strong> a@b.com 出现了两次。</pre>
3253

3354
## 解法
3455

‎solution/0100-0199/0184.Department Highest Salary/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Each row of this table indicates the ID, name, and salary of an employee. It als
3131
| id | int |
3232
| name | varchar |
3333
+-------------+---------+
34-
id is the primary key column for this table.
34+
id is the primary key column for this table. It is guaranteed that department name is not <code>NULL.</code>
3535
Each row of this table indicates the ID of a department and its name.
3636
</pre>
3737

‎solution/0200-0299/0245.Shortest Word Distance III/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给定一个字符串数组&nbsp;<code>wordsDict</code> 和两个字符串 <code>word1</code> 和 <code>word2</code> ,返回列表中这两个单词之间的最短距离。</p>
9+
<p>给定一个字符串数组&nbsp;<code>wordsDict</code> 和两个字符串 <code>word1</code> 和 <code>word2</code> ,返回这两个单词在列表中出现的最短距离。</p>
1010

1111
<p>注意:<code>word1</code> 和 <code>word2</code>&nbsp;是有可能相同的,并且它们将分别表示为列表中 <strong>两个独立的单词</strong> 。</p>
1212

1313
<p>&nbsp;</p>
1414

15-
<p><strong>示例 1:</strong></p>
15+
<p><strongclass="example">示例 1:</strong></p>
1616

1717
<pre>
1818
<strong>输入:</strong>wordsDict = ["practice", "makes", "perfect", "coding", "makes"], word1 = "makes", word2 = "coding"
1919
<strong>输出:</strong>1
2020
</pre>
2121

22-
<p><strong>示例 2:</strong></p>
22+
<p><strongclass="example">示例 2:</strong></p>
2323

2424
<pre>
2525
<strong>输入:</strong>wordsDict = ["practice", "makes", "perfect", "coding", "makes"], word1 = "makes", word2 = "makes"

‎solution/0400-0499/0464.Can I Win/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<p>例如,两个玩家可以轮流从公共整数池中抽取从 1 到 15 的整数(不放回),直到累计整数和 &gt;= 100。</p>
1414

15-
<p>给定两个整数&nbsp;<code>maxChoosableInteger</code>&nbsp;(整数池中可选择的最大数)和&nbsp;<code>desiredTotal</code>(累计和),若先出手的玩家是否能稳赢则返回 <code>true</code>&nbsp;,否则返回 <code>false</code> 。假设两位玩家游戏时都表现 <strong>最佳</strong> 。</p>
15+
<p>给定两个整数&nbsp;<code>maxChoosableInteger</code>&nbsp;(整数池中可选择的最大数)和&nbsp;<code>desiredTotal</code>(累计和),若先出手的玩家能稳赢则返回 <code>true</code>&nbsp;,否则返回 <code>false</code> 。假设两位玩家游戏时都表现 <strong>最佳</strong> 。</p>
1616

1717
<p>&nbsp;</p>
1818

‎solution/0500-0599/0585.Investments in 2016/README_EN.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pid is the primary key column for this table.
2020
Each row of this table contains information about one policy where:
2121
pid is the policyholder&#39;s policy ID.
2222
tiv_2015 is the total investment value in 2015 and tiv_2016 is the total investment value in 2016.
23-
lat is the latitude of the policy holder&#39;s city.
24-
lon is the longitude of the policy holder&#39;s city.
23+
lat is the latitude of the policy holder&#39;s city. It&#39;s guaranteed that lat is not NULL.
24+
lon is the longitude of the policy holder&#39;s city. It&#39;s guaranteed that lon is not NULL.
2525
</pre>
2626

2727
<p>&nbsp;</p>

‎solution/0900-0999/0913.Cat and Mouse/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<li><code>0 &lt;= graph[i][j] &lt; graph.length</code></li>
5858
<li><code>graph[i][j] != i</code></li>
5959
<li><code>graph[i]</code> 互不相同</li>
60-
<li>猫和老鼠在游戏中总是移动</li>
60+
<li>猫和老鼠在游戏中总是可以移动</li>
6161
</ul>
6262

6363
## 解法

‎solution/1000-1099/1011.Capacity To Ship Packages Within D Days/README_EN.md‎

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,78 +11,50 @@
1111
<p>Return the least weight capacity of the ship that will result in all the packages on the conveyor belt being shipped within <code>days</code> days.</p>
1212

1313
<p>&nbsp;</p>
14-
1514
<p><strong class="example">Example 1:</strong></p>
1615

1716
<pre>
18-
1917
<strong>Input:</strong> weights = [1,2,3,4,5,6,7,8,9,10], days = 5
20-
2118
<strong>Output:</strong> 15
22-
2319
<strong>Explanation:</strong> A ship capacity of 15 is the minimum to ship all the packages in 5 days like this:
24-
2520
1st day: 1, 2, 3, 4, 5
26-
2721
2nd day: 6, 7
28-
2922
3rd day: 8
30-
3123
4th day: 9
32-
3324
5th day: 10
3425

35-
36-
3726
Note that the cargo must be shipped in the order given, so using a ship of capacity 14 and splitting the packages into parts like (2, 3, 4, 5), (1, 6, 7), (8), (9), (10) is not allowed.
38-
3927
</pre>
4028

4129
<p><strong class="example">Example 2:</strong></p>
4230

4331
<pre>
44-
4532
<strong>Input:</strong> weights = [3,2,2,4,1,4], days = 3
46-
4733
<strong>Output:</strong> 6
48-
4934
<strong>Explanation:</strong> A ship capacity of 6 is the minimum to ship all the packages in 3 days like this:
50-
5135
1st day: 3, 2
52-
5336
2nd day: 2, 4
54-
5537
3rd day: 1, 4
56-
5738
</pre>
5839

5940
<p><strong class="example">Example 3:</strong></p>
6041

6142
<pre>
62-
6343
<strong>Input:</strong> weights = [1,2,3,1,1], days = 4
64-
6544
<strong>Output:</strong> 3
66-
6745
<strong>Explanation:</strong>
68-
6946
1st day: 1
70-
7147
2nd day: 2
72-
7348
3rd day: 3
74-
7549
4th day: 1, 1
76-
7750
</pre>
7851

7952
<p>&nbsp;</p>
80-
8153
<p><strong>Constraints:</strong></p>
8254

8355
<ul>
84-
<li><code>1 &lt;= days &lt;= weights.length &lt;= 5 * 10<sup>4</sup></code></li>
85-
<li><code>1 &lt;= weights[i] &lt;= 500</code></li>
56+
<li><code>1 &lt;= days &lt;= weights.length &lt;= 5 * 10<sup>4</sup></code></li>
57+
<li><code>1 &lt;= weights[i] &lt;= 500</code></li>
8658
</ul>
8759

8860
## Solutions

‎solution/1000-1099/1031.Maximum Sum of Two Non-Overlapping Subarrays/README.md‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,47 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给出非负整数数组 <code>A</code> ,返回两个非重叠(连续)子数组中元素的最大和,子数组的长度分别为 <code>L</code> 和 <code>M</code>。(这里需要澄清的是,长为 L 的子数组可以出现在长为 M 的子数组之前或之后。)</p>
9+
<p>给你一个整数数组 <code>nums</code> 和两个整数 <code>firstLen</code> 和 <code>secondLen</code>,请你找出并返回两个非重叠<strong> 子数组 </strong>中元素的最大和<em>,</em>长度分别为 <code>firstLen</code> 和 <code>secondLen</code> 。</p>
1010

11-
<p>从形式上看,返回最大的 <code>V</code>,而 <code>V = (A[i] + A[i+1] + ... + A[i+L-1]) + (A[j] + A[j+1] + ... + A[j+M-1])</code> 并满足下列条件之一:</p>
11+
<p>长度为 <code>firstLen</code> 的子数组可以出现在长为 <code>secondLen</code> 的子数组之前或之后,但二者必须是不重叠的。</p>
1212

13-
<p>&nbsp;</p>
14-
15-
<ul>
16-
<li><code>0 &lt;= i &lt; i + L - 1 &lt; j &lt; j + M - 1 &lt; A.length</code>, <strong>或</strong></li>
17-
<li><code>0 &lt;= j &lt; j + M - 1 &lt; i &lt; i + L - 1 &lt; A.length</code>.</li>
18-
</ul>
13+
<p>子数组是数组的一个 <strong>连续</strong> 部分。</p>
1914

2015
<p>&nbsp;</p>
2116

2217
<p><strong>示例 1:</strong></p>
2318

2419
<pre>
25-
<strong>输入:</strong>A = [0,6,5,2,2,5,1,9,4], L = 1, M = 2
20+
<strong>输入:</strong>nums = [0,6,5,2,2,5,1,9,4], firstLen = 1, secondLen = 2
2621
<strong>输出:</strong>20
2722
<strong>解释:</strong>子数组的一种选择中,[9] 长度为 1,[6,5] 长度为 2。
2823
</pre>
2924

3025
<p><strong>示例 2:</strong></p>
3126

3227
<pre>
33-
<strong>输入:</strong>A = [3,8,1,3,2,1,8,9,0], L = 3, M = 2
28+
<strong>输入:</strong>nums = [3,8,1,3,2,1,8,9,0], firstLen = 3, secondLen = 2
3429
<strong>输出:</strong>29
3530
<strong>解释:</strong>子数组的一种选择中,[3,8,1] 长度为 3,[8,9] 长度为 2。
3631
</pre>
3732

3833
<p><strong>示例 3:</strong></p>
3934

4035
<pre>
41-
<strong>输入:</strong>A = [2,1,5,6,0,9,5,0,3,8], L = 4, M = 3
36+
<strong>输入:</strong>nums = [2,1,5,6,0,9,5,0,3,8], firstLen = 4, secondLen = 3
4237
<strong>输出:</strong>31
43-
<strong>解释:</strong>子数组的一种选择中,[5,6,0,9] 长度为 4,[0,3,8] 长度为 3。</pre>
38+
<strong>解释:</strong>子数组的一种选择中,[5,6,0,9] 长度为 4,[0,3,8] 长度为 3。
39+
</pre>
4440

4541
<p>&nbsp;</p>
4642

4743
<p><strong>提示:</strong></p>
4844

4945
<ul>
50-
<li><code>L &gt;= 1</code></li>
51-
<li><code>M &gt;= 1</code></li>
52-
<li><code>L + M &lt;= A.length &lt;= 1000</code></li>
53-
<li><code>0 &lt;= A[i] &lt;= 1000</code></li>
46+
<li><code>1 &lt;= firstLen, secondLen &lt;= 1000</code></li>
47+
<li><code>2 &lt;= firstLen + secondLen &lt;= 1000</code></li>
48+
<li><code>firstLen + secondLen &lt;= nums.length &lt;= 1000</code></li>
49+
<li><code>0 &lt;= nums[i] &lt;= 1000</code></li>
5450
</ul>
5551

5652
## 解法

‎solution/1000-1099/1045.Customers Who Bought All Products/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| customer_id | int |
1414
| product_key | int |
1515
+-------------+---------+
16-
There is no primary key for this table. It may contain duplicates.
16+
There is no primary key for this table. It may contain duplicates. <code>customer_id</code> is not NULL<code>.</code>
1717
product_key is a foreign key to <code>Product</code> table.
1818
</pre>
1919

‎solution/1000-1099/1075.Project Employees I/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Each row of this table indicates that the employee with employee_id is working o
3030
| name | varchar |
3131
| experience_years | int |
3232
+------------------+---------+
33-
employee_id is the primary key of this table.
33+
employee_id is the primary key of this table. It&#39;s guaranteed that experience_years is not NULL.
3434
Each row of this table contains information about one employee.
3535
</pre>
3636

0 commit comments

Comments
(0)

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