Skip to content

Commit 12f831a

Browse files
authored
feat: add new lc problems and solutions: No.2784~2791 (doocs#1276)
* No.2784. Check if Array is Good * No.2785. Sort Vowels in a String * No.2786. Visit Array Positions to Maximize Score * No.2787. Ways to Express an Integer as Sum of Powers * No.2788. Split Strings by Separator * No.2789. Largest Element in an Array after Merge Operations * No.2790. Maximum Number of Groups With Increasing Length * No.2791. Count Paths That Can Form a Palindrome in a Tree
1 parent b9960e5 commit 12f831a

File tree

133 files changed

+3706
-236
lines changed

Some content is hidden

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

133 files changed

+3706
-236
lines changed

solution/0100-0199/0176.Second Highest Salary/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
| id | int |
1818
| salary | int |
1919
+-------------+------+
20-
id 是这个表的主键。
20+
在 SQL 中,id 是这个表的主键。
2121
表的每一行包含员工的工资信息。
2222
</pre>
2323

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

26-
<p>编写一个 SQL 查询,获取并返回 <code>Employee</code>&nbsp;表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 <code>null</code> 。</p>
26+
<p>查询并返回 <code>Employee</code>&nbsp;表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 <code>null(Pandas 则返回 None)</code> 。</p>
2727

2828
<p>查询结果如下例所示。</p>
2929

solution/0100-0199/0176.Second Highest Salary/README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
| id | int |
1414
| salary | int |
1515
+-------------+------+
16-
id is the primary key column for this table.
16+
In SQL, id is the primary key column for this table.
1717
Each row of this table contains information about the salary of an employee.
1818
</pre>
1919

2020
<p>&nbsp;</p>
2121

22-
<p>Find&nbsp;the second highest salary from the <code>Employee</code> table. If there is no second highest salary,&nbsp;return&nbsp;<code>null</code>.</p>
22+
<p>Find&nbsp;the second highest salary from the <code>Employee</code> table. If there is no second highest salary,&nbsp;return&nbsp;<code>null (return&nbsp;None in Pandas)</code>.</p>
2323

2424
<p>The result format is in the following example.</p>
2525

solution/0100-0199/0177.Nth Highest Salary/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
| id | int |
1616
| salary | int |
1717
+-------------+------+
18-
Id是该表的主键列
18+
在 SQL 中,id 是该表的主键
1919
该表的每一行都包含有关员工工资的信息。
2020
</pre>
2121

2222
<p>&nbsp;</p>
2323

24-
<p>编写一个SQL查询来报告 <code>Employee</code> 表中第 <code>n</code> 高的工资。如果没有第 <code>n</code> 个最高工资,查询应该报告为&nbsp;<code>null</code> 。</p>
24+
<p>查询&nbsp;<code>Employee</code> 表中第 <code>n</code> 高的工资。如果没有第 <code>n</code> 个最高工资,查询结果应该为&nbsp;<code>null</code> 。</p>
2525

2626
<p>查询结果格式如下所示。</p>
2727

solution/0100-0199/0177.Nth Highest Salary/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| id | int |
1414
| salary | int |
1515
+-------------+------+
16-
id is the primary key column for this table.
16+
In SQL, id is the primary key column for this table.
1717
Each row of this table contains information about the salary of an employee.
1818
</pre>
1919

solution/0100-0199/0178.Rank Scores/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
| id | int |
1616
| score | decimal |
1717
+-------------+---------+
18-
Id是该表的主键
19-
该表的每一行都包含了一场比赛的分数。Score是一个有两位小数点的浮点值
18+
在 SQL 中,id 是该表的主键
19+
该表的每一行都包含了一场比赛的分数。Score 是一个有两位小数点的浮点值
2020
</pre>
2121

2222
<p>&nbsp;</p>
2323

24-
<p>编写 SQL 查询对分数进行排序。排名按以下规则计算:</p>
24+
<p>查询并对分数进行排序。排名按以下规则计算:</p>
2525

2626
<ul>
2727
<li>分数应按从高到低排列。</li>

solution/0100-0199/0178.Rank Scores/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| id | int |
1414
| score | decimal |
1515
+-------------+---------+
16-
id is the primary key for this table.
16+
In SQL, id is the primary key for this table.
1717
Each row of this table contains the score of a game. Score is a floating point value with two decimal places.
1818
</pre>
1919

solution/0100-0199/0183.Customers Who Never Order/README.md

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,68 @@
66

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

9-
<p>某网站包含两个表,<code>Customers</code> 表和 <code>Orders</code> 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。</p>
10-
119
<p><code>Customers</code> 表:</p>
1210

13-
<pre>+----+-------+
14-
| Id | Name |
11+
<pre>
12+
+-------------+---------+
13+
| Column Name | Type |
14+
+-------------+---------+
15+
| id | int |
16+
| name | varchar |
17+
+-------------+---------+
18+
在 SQL 中,id 是该表的主键。
19+
该表的每一行都表示客户的 ID 和名称。</pre>
20+
21+
<p><code>Orders</code> 表:</p>
22+
23+
<pre>
24+
+-------------+------+
25+
| Column Name | Type |
26+
+-------------+------+
27+
| id | int |
28+
| customerId | int |
29+
+-------------+------+
30+
在 SQL 中,id 是该表的主键。
31+
customerId 是 Customers 表中 ID 的外键( Pandas 中的连接键)。
32+
该表的每一行都表示订单的 ID 和订购该订单的客户的 ID。</pre>
33+
34+
<p>&nbsp;</p>
35+
36+
<p>找出所有从不点任何东西的顾客。</p>
37+
38+
<p>以 <strong>任意顺序</strong> 返回结果表。</p>
39+
40+
<p>结果格式如下所示。</p>
41+
42+
<p>&nbsp;</p>
43+
44+
<p><strong>示例 1:</strong></p>
45+
46+
<pre>
47+
<b>输入:</b>
48+
Customers table:
49+
+----+-------+
50+
| id | name |
1551
+----+-------+
1652
| 1 | Joe |
1753
| 2 | Henry |
1854
| 3 | Sam |
1955
| 4 | Max |
2056
+----+-------+
21-
</pre>
22-
23-
<p><code>Orders</code> 表:</p>
24-
25-
<pre>+----+------------+
26-
| Id | CustomerId |
57+
Orders table:
58+
+----+------------+
59+
| id | customerId |
2760
+----+------------+
2861
| 1 | 3 |
2962
| 2 | 1 |
3063
+----+------------+
31-
</pre>
32-
33-
<p>例如给定上述表格,你的查询应返回:</p>
34-
35-
<pre>+-----------+
64+
<b>输出:</b>
65+
+-----------+
3666
| Customers |
3767
+-----------+
3868
| Henry |
3969
| Max |
40-
+-----------+
41-
</pre>
70+
+-----------+</pre>
4271

4372
## 解法
4473

solution/0100-0199/0183.Customers Who Never Order/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| id | int |
1414
| name | varchar |
1515
+-------------+---------+
16-
id is the primary key column for this table.
16+
In SQL, id is the primary key column for this table.
1717
Each row of this table indicates the ID and name of a customer.
1818
</pre>
1919

@@ -28,8 +28,8 @@ Each row of this table indicates the ID and name of a customer.
2828
| id | int |
2929
| customerId | int |
3030
+-------------+------+
31-
id is the primary key column for this table.
32-
customerId is a foreign key of the ID from the Customers table.
31+
In SQL, id is the primary key column for this table.
32+
customerId is a foreign key (join key in Pandas) of the ID from the Customers table.
3333
Each row of this table indicates the ID of an order and the ID of the customer who ordered it.
3434
</pre>
3535

solution/0100-0199/0184.Department Highest Salary/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
| salary | int |
1818
| departmentId | int |
1919
+--------------+---------+
20-
id是此表的主键列
21-
departmentId是Department表中ID的外键
22-
此表的每一行都表示员工的ID、姓名和工资。它还包含他们所在部门的ID
20+
在 SQL 中,id是此表的主键
21+
departmentId 是 Department 表中 id 的外键(在 Pandas 中称为 join key)
22+
此表的每一行都表示员工的 id、姓名和工资。它还包含他们所在部门的 id
2323
</pre>
2424

2525
<p>&nbsp;</p>
@@ -33,13 +33,13 @@ departmentId是Department表中ID的外键。
3333
| id | int |
3434
| name | varchar |
3535
+-------------+---------+
36-
id是此表的主键列
37-
此表的每一行都表示一个部门的ID及其名称
36+
在 SQL 中,id 是此表的主键列
37+
此表的每一行都表示一个部门的 id 及其名称
3838
</pre>
3939

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

42-
<p>编写SQL查询以查找每个部门中薪资最高的员工。<br />
42+
<p>查找出每个部门中薪资最高的员工。<br />
4343
按 <strong>任意顺序</strong> 返回结果表。<br />
4444
查询结果格式如下例所示。</p>
4545

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
| salary | int |
1616
| departmentId | int |
1717
+--------------+---------+
18-
id is the primary key column for this table.
19-
departmentId is a foreign key of the ID from the <code>Department </code>table.
18+
In SQL, id is the primary key column for this table.
19+
departmentId is a foreign key (join key in Pandas) of the ID from the <code>Department </code>table.
2020
Each row of this table indicates the ID, name, and salary of an employee. It also contains the ID of their department.
2121
</pre>
2222

@@ -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. It is guaranteed that department name is not <code>NULL.</code>
34+
In SQL, 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

0 commit comments

Comments
 (0)