Skip to content

Commit a18ee09

Browse files
authored
chore: update lc problems (#1766)
1 parent db3e63c commit a18ee09

File tree

15 files changed

+186
-146
lines changed

15 files changed

+186
-146
lines changed

.github/workflows/sync.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Sync
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
sync:
9+
runs-on: ubuntu-latest
10+
if: github.repository == 'doocs/leetcode'
11+
steps:
12+
- name: Sync to gitee.com
13+
uses: wearerequired/git-mirror-action@master
14+
env:
15+
SSH_PRIVATE_KEY: ${{ secrets.RSA_PRIVATE_KEY }}
16+
with:
17+
source-repo: git@github.com:doocs/leetcode.git
18+
destination-repo: git@gitee.com:Doocs/leetcode.git
19+
20+
- name: Build Gitee Pages
21+
uses: yanglbme/gitee-pages-action@main
22+
with:
23+
gitee-username: yanglbme
24+
gitee-password: ${{ secrets.GITEE_PASSWORD }}
25+
gitee-repo: doocs/leetcode
26+
branch: main

solution/2800-2899/2877.Create a DataFrame from List/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
# [2877. Create a DataFrame from List](https://leetcode.cn/problems/create-a-dataframe-from-list)
1+
# [2877. 从表中创建 DataFrame](https://leetcode.cn/problems/create-a-dataframe-from-list)
22

33
[English Version](/solution/2800-2899/2877.Create%20a%20DataFrame%20from%20List/README_EN.md)
44

55
## 题目描述
66

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

9-
<p>Write a solution to <strong>create</strong> a DataFrame from a 2D list called <code>student_data</code>. This 2D list contains the IDs and ages of some students.</p>
9+
<p>编写一个解决方案,从名为 &nbsp;<code>student_data</code>&nbsp;的二维列表&nbsp;<b>创建 </b>一个 DataFrame 。这个二维列表包含一些学生的 ID 和年龄信息。</p>
1010

11-
<p>The DataFrame should have two columns, <code>student_id</code> and <code>age</code>, and be in the same order as the original 2D list.</p>
11+
<p>DataFrame 应该有两列,&nbsp;<code>student_id</code>&nbsp;&nbsp;<code>age</code>,并且与原始二维列表的顺序相同。</p>
1212

13-
<p>The result format is in the following example.</p>
13+
<p>返回结果格式如下示例所示。</p>
1414

1515
<p>&nbsp;</p>
16-
<p><strong class="example">Example 1:</strong></p>
16+
17+
<p><strong class="example">示例 1:</strong></p>
1718

1819
<pre>
19-
<strong>Input:
20+
<strong>输入:
2021
</strong>student_data:<strong>
2122
</strong><code>[
2223
[1, 15],
2324
[2, 11],
2425
[3, 11],
2526
[4, 20]
2627
]</code>
27-
<strong>Output:</strong>
28+
<b>输出:</b>
2829
+------------+-----+
2930
| student_id | age |
3031
+------------+-----+
@@ -33,8 +34,8 @@
3334
| 3 | 11 |
3435
| 4 | 20 |
3536
+------------+-----+
36-
<strong>Explanation:</strong>
37-
A DataFrame was created on top of student_data, with two columns named <code>student_id</code> and <code>age</code>.
37+
<b>解释:</b>
38+
student_data 上创建了一个 DataFrame,包含 student_idage 两列。
3839
</pre>
3940

4041
## 解法

solution/2800-2899/2881.Create a New Column/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [2881. Create a New Column](https://leetcode.cn/problems/create-a-new-column)
1+
# [2881. 创建新列](https://leetcode.cn/problems/create-a-new-column)
22

33
[English Version](/solution/2800-2899/2881.Create%20a%20New%20Column/README_EN.md)
44

@@ -16,17 +16,18 @@ DataFrame <code>employees</code>
1616
+-------------+--------+
1717
</pre>
1818

19-
<p>A&nbsp;company plans to provide its employees with a bonus.</p>
19+
<p>一家公司计划为员工提供奖金。</p>
2020

21-
<p>Write a solution to create a new column name <code>bonus</code> that contains the <strong>doubled values</strong> of the <code>salary</code> column.</p>
21+
<p>编写一个解决方案,创建一个名为&nbsp;<code>bonus</code>&nbsp;的新列,其中包含&nbsp;<code>salary</code>&nbsp;值的&nbsp;<strong>两倍</strong>。</p>
2222

23-
<p>The result format is in the following example.</p>
23+
<p>返回结果格式如下示例所示。</p>
2424

2525
<p>&nbsp;</p>
26-
<p><strong class="example">Example 1:</strong></p>
26+
27+
<p><b>示例 1:</b></p>
2728

2829
<pre>
29-
<strong>Input:</strong>
30+
<b>输入:</b>
3031
DataFrame employees
3132
+---------+--------+
3233
| name | salary |
@@ -38,7 +39,7 @@ DataFrame employees
3839
| Finn | 74576 |
3940
| Thomas | 24433 |
4041
+---------+--------+
41-
<strong>Output:</strong>
42+
<b>输出:</b>
4243
+---------+--------+--------+
4344
| name | salary | bonus |
4445
+---------+--------+--------+
@@ -49,8 +50,8 @@ DataFrame employees
4950
| Finn | 74576 | 149152 |
5051
| Thomas | 24433 | 48866 |
5152
+---------+--------+--------+
52-
<strong>Explanation:</strong>
53-
A new column bonus is created by doubling the value in the column salary.</pre>
53+
<b>解释:</b>
54+
通过将salary列中的值加倍创建了一个新的bonus列。</pre>
5455

5556
## 解法
5657

solution/2800-2899/2882.Drop Duplicate Rows/README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [2882. Drop Duplicate Rows](https://leetcode.cn/problems/drop-duplicate-rows)
1+
# [2882. 删去重复的行](https://leetcode.cn/problems/drop-duplicate-rows)
22

33
[English Version](/solution/2800-2899/2882.Drop%20Duplicate%20Rows/README_EN.md)
44

@@ -17,16 +17,18 @@ DataFrame customers
1717
+-------------+--------+
1818
</pre>
1919

20-
<p>There are some duplicate rows in the DataFrame based on the <code>email</code> column.</p>
20+
<p>DataFrame 中基于&nbsp;<code>email</code>&nbsp;列存在一些重复行。</p>
2121

22-
<p>Write a solution to remove these duplicate rows and keep only the <strong>first</strong> occurrence.</p>
22+
<p>编写一个解决方案,删除这些重复行,仅保留第一次出现的行。</p>
2323

24-
<p>The result format is in the following example.</p>
24+
<p>返回结果格式如下例所示。</p>
2525

2626
<p>&nbsp;</p>
27+
28+
<p><strong>示例 1:</strong></p>
29+
2730
<pre>
28-
<strong class="example">Example 1:</strong>
29-
<strong>Input:</strong>
31+
<b>输入:</b>
3032
+-------------+---------+---------------------+
3133
| customer_id | name | email |
3234
+-------------+---------+---------------------+
@@ -37,7 +39,7 @@ DataFrame customers
3739
| 5 | Finn | john@example.com |
3840
| 6 | Violet | alice@example.com |
3941
+-------------+---------+---------------------+
40-
<strong>Output: </strong>
42+
<b>输出:</b>
4143
+-------------+---------+---------------------+
4244
| customer_id | name | email |
4345
+-------------+---------+---------------------+
@@ -47,8 +49,8 @@ DataFrame customers
4749
| 4 | Alice | john@example.com |
4850
| 6 | Violet | alice@example.com |
4951
+-------------+---------+---------------------+
50-
<strong>Explanation:</strong>
51-
Alic (customer_id = 4) and Finn (customer_id = 5) both use john@example.com, so only the first occurrence of this email is retained.
52+
<b>解释:</b>
53+
Alice (customer_id = 4) Finn (customer_id = 5) 都使用 john@example.com,因此只保留该邮箱地址的第一次出现。
5254
</pre>
5355

5456
## 解法

solution/2800-2899/2883.Drop Missing Data/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [2883. Drop Missing Data](https://leetcode.cn/problems/drop-missing-data)
1+
# [2883. 删去丢失的数据](https://leetcode.cn/problems/drop-missing-data)
22

33
[English Version](/solution/2800-2899/2883.Drop%20Missing%20Data/README_EN.md)
44

@@ -17,17 +17,18 @@ DataFrame students
1717
+-------------+--------+
1818
</pre>
1919

20-
<p>There are some rows having missing values in the <code>name</code> column.</p>
20+
<p><code>name</code> 列里有一些具有缺失值的行。</p>
2121

22-
<p>Write a solution to remove the rows with missing values.</p>
22+
<p>编写一个解决方案,删除具有缺失值的行。</p>
2323

24-
<p>The result format is in the following example.</p>
24+
<p>返回结果格式如下示例所示。</p>
2525

2626
<p>&nbsp;</p>
27-
<p><strong class="example">Example 1:</strong></p>
27+
28+
<p><b>示例 1:</b></p>
2829

2930
<pre>
30-
<strong>Input:
31+
<strong>输入:
3132
</strong>+------------+-------+-----+
3233
| student_id | name | age |
3334
+------------+-------+-----+
@@ -36,15 +37,15 @@ DataFrame students
3637
| 779 | None | 20 |
3738
| 849 | None | 14 |
3839
+------------+-------+-----+
39-
<strong>Output:
40+
<strong>输出:
4041
</strong>+------------+-------+-----+
4142
| student_id | name | age |
4243
+------------+-------+-----+
4344
| 32 | Piper | 5 |
4445
| 217 | Grace | 19 |
4546
+------------+-------+-----+
46-
<strong>Explanation:</strong>
47-
Students with ids 779 and 849 have empty values in the name column, so they will be removed.</pre>
47+
<b>解释:
48+
</b>学号为 779 849 的学生所在行在 name 列中有空值,因此它们将被删除。</pre>
4849

4950
## 解法
5051

solution/2800-2899/2884.Modify Columns/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [2884. Modify Columns](https://leetcode.cn/problems/modify-columns)
1+
# [2884. 修改列](https://leetcode.cn/problems/modify-columns)
22

33
[English Version](/solution/2800-2899/2884.Modify%20Columns/README_EN.md)
44

@@ -16,17 +16,18 @@ DataFrame <code>employees</code>
1616
+-------------+--------+
1717
</pre>
1818

19-
<p>A company intends to give its employees a pay rise.</p>
19+
<p>一家公司决定增加员工的薪水。</p>
2020

21-
<p>Write a solution to <strong>modify</strong> the <code>salary</code> column by multiplying each salary by 2.</p>
21+
<p>编写一个解决方案,将每个员工的薪水乘以2来 <strong>修改</strong>&nbsp;<code>salary</code>&nbsp;列。</p>
2222

23-
<p>The result format is in the following example.</p>
23+
<p>返回结果格式如下示例所示。</p>
2424

2525
<p>&nbsp;</p>
26-
<p><strong class="example">Example 1:</strong></p>
26+
27+
<p><b>示例 1:</b></p>
2728

2829
<pre>
29-
<strong>Input:
30+
<strong>输入:
3031
</strong>DataFrame employees
3132
+---------+--------+
3233
| name | salary |
@@ -36,7 +37,7 @@ DataFrame <code>employees</code>
3637
| Mia | 62509 |
3738
| Ulysses | 54866 |
3839
+---------+--------+
39-
<strong>Output:
40+
<strong>输出:
4041
</strong>+---------+--------+
4142
| name | salary |
4243
+---------+--------+
@@ -45,8 +46,8 @@ DataFrame <code>employees</code>
4546
| Mia | 125018 |
4647
| Ulysses | 109732 |
4748
+---------+--------+
48-
<strong>Explanation:
49-
</strong>Every salary has been doubled.</pre>
49+
<strong>解释:
50+
</strong>每个人的薪水都被加倍。</pre>
5051

5152
## 解法
5253

solution/2800-2899/2885.Rename Columns/README.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [2885. Rename Columns](https://leetcode.cn/problems/rename-columns)
1+
# [2885. 重命名列](https://leetcode.cn/problems/rename-columns)
22

33
[English Version](/solution/2800-2899/2885.Rename%20Columns/README_EN.md)
44

@@ -18,21 +18,23 @@ DataFrame <code>students</code>
1818
+-------------+--------+
1919
</pre>
2020

21-
<p>Write a solution to rename the columns as follows:</p>
21+
<p>编写一个解决方案,按以下方式重命名列:</p>
2222

2323
<ul>
24-
<li><code>id</code> to <code>student_id</code></li>
25-
<li><code>first</code> to <code>first_name</code></li>
26-
<li><code>last</code> to <code>last_name</code></li>
27-
<li><code>age</code> to <code>age_in_years</code></li>
24+
<li><code>id</code>&nbsp;重命名为&nbsp;<code>student_id</code></li>
25+
<li><code>first</code>&nbsp;重命名为&nbsp;<code>first_name</code></li>
26+
<li><code>last</code>&nbsp;重命名为&nbsp;<code>last_name</code></li>
27+
<li><code>age</code>&nbsp;重命名为&nbsp;<code>age_in_years</code></li>
2828
</ul>
2929

30-
<p>The result format is in the following example.</p>
30+
<p>返回结果格式如下示例所示。</p>
3131

3232
<p>&nbsp;</p>
33+
34+
<p><strong>示例 1:</strong></p>
35+
3336
<pre>
34-
<strong class="example">Example 1:</strong>
35-
<strong>Input:
37+
<strong>输入:
3638
</strong>+----+---------+----------+-----+
3739
| id | first | last | age |
3840
+----+---------+----------+-----+
@@ -42,7 +44,7 @@ DataFrame <code>students</code>
4244
| 4 | Georgia | Thompson | 18 |
4345
| 5 | Thomas | Moore | 10 |
4446
+----+---------+----------+-----+
45-
<strong>Output:</strong>
47+
<b>输出:</b>
4648
+------------+------------+-----------+--------------+
4749
| student_id | first_name | last_name | age_in_years |
4850
+------------+------------+-----------+--------------+
@@ -52,8 +54,8 @@ DataFrame <code>students</code>
5254
| 4 | Georgia | Thompson | 18 |
5355
| 5 | Thomas | Moore | 10 |
5456
+------------+------------+-----------+--------------+
55-
<strong>Explanation:</strong>
56-
The column names are changed accordingly.</pre>
57+
<b>解释:</b>
58+
列名已相应更换。</pre>
5759

5860
## 解法
5961

solution/2800-2899/2886.Change Data Type/README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [2886. Change Data Type](https://leetcode.cn/problems/change-data-type)
1+
# [2886. 改变数据类型](https://leetcode.cn/problems/change-data-type)
22

33
[English Version](/solution/2800-2899/2886.Change%20Data%20Type/README_EN.md)
44

@@ -18,32 +18,34 @@ DataFrame <code>students</code>
1818
+-------------+--------+
1919
</pre>
2020

21-
<p>Write a solution to correct the errors:</p>
21+
<p>编写一个解决方案来纠正以下错误:</p>
2222

23-
<p>The <code>grade</code> column is stored as floats,&nbsp;convert it to integers.</p>
23+
<p>&nbsp;<code>grade</code>&nbsp;列被存储为浮点数,将它转换为整数。</p>
2424

25-
<p>The result format is in the following example.</p>
25+
<p>返回结果格式如下示例所示。</p>
2626

2727
<p>&nbsp;</p>
28+
29+
<p><strong>示例 1:</strong></p>
30+
2831
<pre>
29-
<strong class="example">Example 1:</strong>
30-
<strong>Input:
32+
<strong>输入:
3133
</strong>DataFrame students:
3234
+------------+------+-----+-------+
3335
| student_id | name | age | grade |
3436
+------------+------+-----+-------+
3537
| 1 | Ava | 6 | 73.0 |
3638
| 2 | Kate | 15 | 87.0 |
3739
+------------+------+-----+-------+
38-
<strong>Output:
40+
<strong>输出:
3941
</strong>+------------+------+-----+-------+
4042
| student_id | name | age | grade |
4143
+------------+------+-----+-------+
4244
| 1 | Ava | 6 | 73 |
4345
| 2 | Kate | 15 | 87 |
4446
+------------+------+-----+-------+
45-
<strong>Explanation:</strong>
46-
The data types of the column grade is converted to int.</pre>
47+
<b>解释:</b>
48+
grade 列的数据类型已转换为整数。</pre>
4749

4850
## 解法
4951

0 commit comments

Comments
 (0)