Skip to content

Commit aaa7e7e

Browse files
authored
feat: add new lc problems (doocs#1495)
1 parent 6ff5f4c commit aaa7e7e

File tree

84 files changed

+1571
-351
lines changed

Some content is hidden

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

84 files changed

+1571
-351
lines changed

solution/0100-0199/0137.Single Number II/README.md

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

99
<p>给你一个整数数组&nbsp;<code>nums</code> ,除某个元素仅出现 <strong>一次</strong> 外,其余每个元素都恰出现 <strong>三次 。</strong>请你找出并返回那个只出现了一次的元素。</p>
1010

11-
<p>你必须设计并实现线性时间复杂度的算法且不使用额外空间来解决此问题。</p>
11+
<p>你必须设计并实现线性时间复杂度的算法且使用常数级空间来解决此问题。</p>
1212

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

solution/0100-0199/0139.Word Break/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<li><code>1 &lt;= s.length &lt;= 300</code></li>
4545
<li><code>1 &lt;= wordDict.length &lt;= 1000</code></li>
4646
<li><code>1 &lt;= wordDict[i].length &lt;= 20</code></li>
47-
<li><code>s</code> 和 <code>wordDict[i]</code> 仅有小写英文字母组成</li>
47+
<li><code>s</code> 和 <code>wordDict[i]</code> 仅由小写英文字母组成</li>
4848
<li><code>wordDict</code> 中的所有字符串 <strong>互不相同</strong></li>
4949
</ul>
5050

solution/0100-0199/0175.Combine Two Tables/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
| FirstName | varchar |
1717
| LastName | varchar |
1818
+-------------+---------+
19-
personId 是该表的主键列
19+
personId 是该表的主键(具有唯一值的列)
2020
该表包含一些人的 ID 和他们的姓和名的信息。
2121
</pre>
2222

@@ -33,15 +33,17 @@ personId 是该表的主键列。
3333
| City | varchar |
3434
| State | varchar |
3535
+-------------+---------+
36-
addressId 是该表的主键列
36+
addressId 是该表的主键(具有唯一值的列)
3737
该表的每一行都包含一个 ID = PersonId 的人的城市和州的信息。
3838
</pre>
3939

40-
<p>编写一个SQL查询来报告 <code>Person</code> 表中每个人的姓、名、城市和州。如果 <code>personId</code> 的地址不在&nbsp;<code>Address</code>&nbsp;表中,则报告为空 &nbsp;<code>null</code>&nbsp;。</p>
40+
<p>&nbsp;</p>
41+
42+
<p>编写解决方案,报告 <code>Person</code> 表中每个人的姓、名、城市和州。如果 <code>personId</code> 的地址不在&nbsp;<code>Address</code>&nbsp;表中,则报告为&nbsp;<code>null</code>&nbsp;。</p>
4143

4244
<p>以 <strong>任意顺序</strong> 返回结果表。</p>
4345

44-
<p>查询结果格式如下所示。</p>
46+
<p>结果格式如下所示。</p>
4547

4648
<p>&nbsp;</p>
4749

solution/0100-0199/0181.Employees Earning More Than Their Managers/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
| salary | int |
1818
| managerId | int |
1919
+-------------+---------+
20-
Id是该表的主键
20+
id 是该表的主键(具有唯一值的列)
2121
该表的每一行都表示雇员的ID、姓名、工资和经理的ID。
2222
</pre>
2323

2424
<p>&nbsp;</p>
2525

26-
<p>编写一个SQL查询来查找收入比经理高的员工。</p>
26+
<p>编写解决方案,找出收入比经理高的员工。</p>
2727

2828
<p>以 <strong>任意顺序</strong> 返回结果表。</p>
2929

30-
<p>查询结果格式如下所示。</p>
30+
<p>结果格式如下所示。</p>
3131

3232
<p>&nbsp;</p>
3333

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
| id | int |
1818
| email | varchar |
1919
+-------------+---------+
20-
id 是该表的主键列
20+
id 是该表的主键(具有唯一值的列)
2121
此表的每一行都包含一封电子邮件。电子邮件不包含大写字母。
2222
</pre>
2323

2424
<p>&nbsp;</p>
2525

26-
<p>编写一个 SQL 查询来报告所有重复的电子邮件。 请注意,可以保证电子邮件字段不为 NULL。</p>
26+
<p>编写解决方案来报告所有重复的电子邮件。 请注意,可以保证电子邮件字段不为 NULL。</p>
2727

2828
<p>以&nbsp;<strong>任意顺序&nbsp;</strong>返回结果表。</p>
2929

30-
<p>查询结果格式如下例。</p>
30+
<p>结果格式如下例。</p>
3131

3232
<p>&nbsp;</p>
3333

solution/0400-0499/0401.Binary Watch/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<li>For example, <code>&quot;01:00&quot;</code> is not valid. It should be <code>&quot;1:00&quot;</code>.</li>
2121
</ul>
2222

23-
<p>The minute must be consist of two digits and may contain a leading zero.</p>
23+
<p>The minute must&nbsp;consist of two digits and may contain a leading zero.</p>
2424

2525
<ul>
2626
<li>For example, <code>&quot;10:2&quot;</code> is not valid. It should be <code>&quot;10:02&quot;</code>.</li>

solution/0500-0599/0529.Minesweeper/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
<p>&nbsp;</p>
3333

3434
<p><strong>示例 1:</strong></p>
35-
<img src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0500-0599/0529.Minesweeper/images/minesweeper_example_1.png" style="width: 500px; max-width: 400px; height: 269px;" />
35+
<img src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0500-0599/0529.Minesweeper/images/untitled.jpeg" style="width: 500px; max-width: 400px; height: 269px;" />
3636
<pre>
3737
<strong>输入:</strong>board = [["E","E","E","E","E"],["E","E","M","E","E"],["E","E","E","E","E"],["E","E","E","E","E"]], click = [3,0]
3838
<strong>输出:</strong>[["B","1","E","1","B"],["B","1","M","1","B"],["B","1","1","1","B"],["B","B","B","B","B"]]
3939
</pre>
4040

4141
<p><strong>示例 2:</strong></p>
42-
<img src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0500-0599/0529.Minesweeper/images/minesweeper_example_2.png" style="width: 500px; max-width: 400px; height: 275px;" />
42+
<img src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0500-0599/0529.Minesweeper/images/untitled-2.jpeg" style="width: 500px; max-width: 400px; height: 275px;" />
4343
<pre>
4444
<strong>输入:</strong>board = [["B","1","E","1","B"],["B","1","M","1","B"],["B","1","1","1","B"],["B","B","B","B","B"]], click = [1,2]
4545
<strong>输出:</strong>[["B","1","E","1","B"],["B","1","X","1","B"],["B","1","1","1","B"],["B","B","B","B","B"]]

solution/0500-0599/0534.Game Play Analysis III/README.md

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

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

9-
<p>Table:&nbsp;<code>Activity</code></p>
9+
<p>表:<code>Activity</code></p>
1010

1111
<pre>
1212
+--------------+---------+
@@ -17,18 +17,25 @@
1717
| event_date | date |
1818
| games_played | int |
1919
+--------------+---------+
20-
(player_id,event_date)是此表的主键。
20+
(player_id,event_date)是此表的主键(具有唯一值的列)
2121
这张表显示了某些游戏的玩家的活动情况。
2222
每一行是一个玩家的记录,他在某一天使用某个设备注销之前登录并玩了很多游戏(可能是 0 )。
2323
</pre>
2424

2525
<p>&nbsp;</p>
2626

27-
<p>编写一个 SQL 查询,同时报告每组玩家和日期,以及玩家到目前为止玩了多少游戏。也就是说,在此日期之前玩家所玩的游戏总数。详细情况请查看示例。</p>
27+
<p>编写一个解决方案,同时报告每组玩家和日期,以及玩家到 <strong>目前为止</strong> 玩了多少游戏。也就是说,玩家在该日期之前所玩的游戏总数。详细情况请查看示例。</p>
2828

29-
<p>查询结果格式如下所示:</p>
29+
<p>以 <strong>任意顺序</strong> 返回结果表。</p>
30+
31+
<p>结果格式如下所示。</p>
32+
33+
<p>&nbsp;</p>
34+
35+
<p><strong>示例 1:</strong></p>
3036

3137
<pre>
38+
<strong>输入:</strong>
3239
Activity table:
3340
+-----------+-----------+------------+--------------+
3441
| player_id | device_id | event_date | games_played |
@@ -39,8 +46,7 @@ Activity table:
3946
| 3 | 1 | 2016-03-02 | 0 |
4047
| 3 | 4 | 2018-07-03 | 5 |
4148
+-----------+-----------+------------+--------------+
42-
43-
Result table:
49+
<strong>输出:</strong>
4450
+-----------+------------+---------------------+
4551
| player_id | event_date | games_played_so_far |
4652
+-----------+------------+---------------------+
@@ -50,6 +56,7 @@ Result table:
5056
| 3 | 2016-03-02 | 0 |
5157
| 3 | 2018-07-03 | 5 |
5258
+-----------+------------+---------------------+
59+
<strong>解释:</strong>
5360
对于 ID 为 1 的玩家,2016-05-02 共玩了 5+6=11 个游戏,2017-06-25 共玩了 5+6+1=12 个游戏。
5461
对于 ID 为 3 的玩家,2018-07-03 共玩了 0+5=5 个游戏。
5562
请注意,对于每个玩家,我们只关心玩家的登录日期。

solution/0500-0599/0550.Game Play Analysis IV/README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,33 @@
88

99
<p>Table:&nbsp;<code>Activity</code></p>
1010

11-
<pre>+--------------+---------+
11+
<pre>
12+
+--------------+---------+
1213
| Column Name | Type |
1314
+--------------+---------+
1415
| player_id | int |
1516
| device_id | int |
1617
| event_date | date |
1718
| games_played | int |
1819
+--------------+---------+
19-
(player_id,event_date)是此表的主键。
20+
(player_id,event_date)是此表的主键(具有唯一值的列的组合)
2021
这张表显示了某些游戏的玩家的活动情况。
2122
每一行是一个玩家的记录,他在某一天使用某个设备注销之前登录并玩了很多游戏(可能是 0)。
2223
</pre>
2324

2425
<p>&nbsp;</p>
2526

26-
<p>编写一个 SQL 查询,报告在首次登录的第二天再次登录的玩家的比率,四舍五入到小数点后两位。换句话说,您需要计算从首次登录日期开始至少连续两天登录的玩家的数量,然后除以玩家总数。</p>
27+
<p>编写解决方案,报告在首次登录的第二天再次登录的玩家的 <strong>比率</strong>,<strong>四舍五入到小数点后两位</strong>。换句话说,你需要计算从首次登录日期开始至少连续两天登录的玩家的数量,然后除以玩家总数。</p>
28+
29+
<p>结果格式如下所示:</p>
2730

28-
<p>查询结果格式如下所示:</p>
31+
<p>&nbsp;</p>
2932

30-
<pre>Activity table:
33+
<p><strong>示例 1:</strong></p>
34+
35+
<pre>
36+
<strong>输入:</strong>
37+
Activity table:
3138
+-----------+-----------+------------+--------------+
3239
| player_id | device_id | event_date | games_played |
3340
+-----------+-----------+------------+--------------+
@@ -37,13 +44,13 @@
3744
| 3 | 1 | 2016-03-02 | 0 |
3845
| 3 | 4 | 2018-07-03 | 5 |
3946
+-----------+-----------+------------+--------------+
40-
41-
Result table:
47+
<strong>输出:</strong>
4248
+-----------+
4349
| fraction |
4450
+-----------+
4551
| 0.33 |
4652
+-----------+
53+
<strong>解释:</strong>
4754
只有 ID 为 1 的玩家在第一天登录后才重新登录,所以答案是 1/3 = 0.33
4855
</pre>
4956

solution/0500-0599/0580.Count Student Number in Departments/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
| gender | varchar |
1818
| dept_id | int |
1919
+--------------+---------+
20-
Student_id是该表的主键
20+
student_id 是该表的主键(具有唯一值的列)
2121
dept_id是Department表中dept_id的外键。
2222
该表的每一行都表示学生的姓名、性别和所属系的id。
2323
</pre>
@@ -33,16 +33,16 @@ dept_id是Department表中dept_id的外键。
3333
| dept_id | int |
3434
| dept_name | varchar |
3535
+-------------+---------+
36-
Dept_id是该表的主键
36+
dept_id是该表的主键(具有唯一值的列)
3737
该表的每一行包含一个部门的id和名称。</pre>
3838

3939
<p>&nbsp;</p>
4040

41-
<p>编写一个SQL查询,为&nbsp;<code>Department</code>&nbsp;表中的所有部门(甚至是没有当前学生的部门)报告各自的部门名称和每个部门的学生人数。</p>
41+
<p>编写解决方案,为&nbsp;<code>Department</code>&nbsp;表中的所有部门(甚至是没有当前学生的部门)报告各自的部门名称和每个部门的学生人数。</p>
4242

4343
<p>按 <code>student_number</code> <strong>降序&nbsp;</strong>返回结果表。如果是平局,则按 <code>dept_name</code> 的&nbsp; <strong>字母顺序&nbsp;</strong>排序。</p>
4444

45-
<p>查询结果格式如下所示。</p>
45+
<p>结果格式如下所示。</p>
4646

4747
<p>&nbsp;</p>
4848

0 commit comments

Comments
 (0)