Skip to content

Commit 66f2af4

Browse files
committed
feat: update problem template
1 parent f382d84 commit 66f2af4

File tree

20 files changed

+469
-385
lines changed

20 files changed

+469
-385
lines changed

solution/0200-0299/0270.Closest Binary Search Tree Value/README.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,33 @@
66

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

9-
<p>给定一个不为空的二叉搜索树和一个目标值 target,请在该二叉搜索树中找到最接近目标值 target 的数值。</p>
9+
给你二叉搜索树的根节点 <code>root</code> 和一个目标值 <code>target</code> ,请在该二叉搜索树中找到最接近目标值 <code>target</code> 的数值。如果有多个答案,返回最小的那个。
1010

11-
<p><strong>注意:</strong></p>
11+
<p>&nbsp;</p>
1212

13-
<ul>
14-
<li>给定的目标值 target 是一个浮点数</li>
15-
<li>如果有多个答案,返回最小的那个。</li>
16-
</ul>
13+
<p><strong class="example">示例 1:</strong></p>
14+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0200-0299/0270.Closest%20Binary%20Search%20Tree%20Value/images/closest1-1-tree.jpg" style="width: 292px; height: 302px;" />
15+
<pre>
16+
<strong>输入:</strong>root = [4,2,5,1,3], target = 3.714286
17+
<strong>输出:</strong>4
18+
</pre>
1719

18-
<p><strong>示例:</strong></p>
20+
<p><strong class="example">示例 2:</strong></p>
1921

2022
<pre>
21-
<strong>输入:</strong> root = [4,2,5,1,3],目标值 target = 3.714286
23+
<strong>输入:</strong>root = [1], target = 4.428571
24+
<strong>输出:</strong>1
25+
</pre>
2226

23-
4
24-
/ \
25-
2 5
26-
/ \
27-
1 3
27+
<p>&nbsp;</p>
2828

29-
<strong>输出:</strong> 4
30-
</pre>
29+
<p><strong>提示:</strong></p>
30+
31+
<ul>
32+
<li>树中节点的数目在范围 <code>[1, 10<sup>4</sup>]</code> 内</li>
33+
<li><code>0 &lt;= Node.val &lt;= 10<sup>9</sup></code></li>
34+
<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>
35+
</ul>
3136

3237
## 解法
3338

solution/2400-2499/2403.Minimum Time to Kill All Monsters/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
- 第 1 天: 获得 1 点法力值,现在总共拥有 1 点法力值。用尽所有法力值击杀第 2 个怪物。
3535
- 第 2 天: 获得 2 点法力值,现在总共拥有 2 点法力值。
3636
- 第 3 天: 获得 2 点法力值,现在总共拥有 4 点法力值。用尽所有法力值击杀第 3 个怪物。
37-
- 第 4 天: 获得 2 点法力值,现在总共拥有 4 点法力值。 用尽所有法力值击杀第 1 个怪物。
37+
- 第 4 天: 获得 3 点法力值,现在总共拥有 3 点法力值。 用尽所有法力值击杀第 1 个怪物。
3838
可以证明,4 天是最少需要的天数。
3939
</pre>
4040

solution/2500-2599/2590.Design a Todo List/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<li><code>TodoList()</code> 初始化对象。</li>
1515
<li><code>int addTask(int userId, String taskDescription, int dueDate, List&lt;String&gt; tags)</code> 为用户 ID 为 <code>userId</code> 的用户添加一个任务,该任务的到期日期为 <code>dueDate</code>&nbsp;,附带了一个标签列表 <code>tags</code>&nbsp;。返回值为任务的 ID 。该 ID 从 <code>1</code> 开始,<strong>依次</strong> 递增。即,第一个任务的ID应为 <code>1</code> ,第二个任务的 ID 应为 <code>2</code> ,以此类推。</li>
1616
<li><code>List&lt;String&gt; getAllTasks(int userId)</code> 返回未标记为完成状态的 ID 为 <code>userId</code> 的用户的所有任务列表,按照到期日期排序。如果用户没有未完成的任务,则应返回一个空列表。</li>
17-
<li><code>List&lt;String&gt; getTasksForTag(int userId, String tag)</code> 返回 ID 为 <code>userI</code>d 的用户未标记为完成状态且具有 <code>tag</code> 标签之一的所有任务列表,按照到期日期排序。如果不存在此类任务,则返回一个空列表。</li>
17+
<li><code>List&lt;String&gt; getTasksForTag(int userId, String tag)</code> 返回 ID 为 <code>userId</code> 的用户未标记为完成状态且具有 <code>tag</code> 标签之一的所有任务列表,按照到期日期排序。如果不存在此类任务,则返回一个空列表。</li>
1818
<li><code>void completeTask(int userId, int taskId)</code> 仅在任务存在且 ID 为 <code>userId</code> 的用户拥有此任务且它是未完成状态时,将 ID 为 <code>taskId</code> 的任务标记为已完成状态。</li>
1919
</ul>
2020

solution/2600-2699/2664.The Knight’s Tour/README_EN.md

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
<p>Note that a <strong>knight</strong> can <strong>move</strong> from cell <code>(r1, c1)</code> to cell <code>(r2, c2)</code> if <code>0 &lt;= r2 &lt;= m - 1</code> and <code>0 &lt;= c2 &lt;= n - 1</code> and <code>min(abs(r1 - r2), abs(c1 - c2)) = 1</code> and <code>max(abs(r1 - r2), abs(c1 - c2)) = 2</code>.</p>
1414

15-
<p>&nbsp;</p>
16-
1715
<p>&nbsp;</p>
1816
<p><strong>Example 1:</strong></p>
1917

solution/2600-2699/2668.Find Latest Salaries/README.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,35 @@
66

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

9-
<p>Table: <code><font face="monospace">Salary</font></code></p>
9+
<p>表:<code><font face="monospace">Salary</font></code></p>
1010

1111
<pre>
1212
+---------------+---------+
13-
| Column Name | Type |
13+
| 列名 | 类型 |
1414
+---------------+---------+
1515
| emp_id | int |
1616
| firstname | varchar |
1717
| lastname | varchar |
1818
| salary | varchar |
1919
| department_id | varchar |
2020
+---------------+---------+
21-
(emp_id, salary) is the primary key for this table.
22-
Each row contains employees details and their yearly salaries, however, some of the records are old and contain outdated salary information.
21+
(emp_id, salary) 是此表的主键。
22+
每行包含员工的详细信息和他们每年的薪水,但有些记录是旧的,包含过时的薪资信息。
2323
</pre>
2424

25-
<p>Write an SQL query to find the current salary of each employee assuming that salaries increase each year. Output their <code>emp_id</code>, <code>firstname</code>, <code>lastname</code>, <code>salary</code>, and <code>department_id</code>.</p>
25+
<p>编写一个 SQL 查询,找到每个员工的当前薪水,假设薪水每年增加。输出他们的 <code>emp_id</code>&nbsp;<code>firstname</code>&nbsp;<code>lastname</code>&nbsp;<code>salary</code> <code>department_id</code></p>
2626

27-
<p>Return<em> the result table ordered</em>&nbsp;<em>by</em> <code>emp_id</code> <em>in <strong>ascending</strong> order.</em></p>
27+
<p>按升序顺序按 <code>emp_id</code> 排序返回结果表。</p>
2828

29-
<p>The query result format is in the following example.</p>
29+
<p>查询结果格式如下所示。</p>
3030

3131
<p>&nbsp;</p>
32-
<p><strong class="example">Example 1:</strong></p>
32+
33+
<p><strong class="example">示例 1:</strong></p>
3334

3435
<pre>
35-
<strong>Input:
36-
</strong><code>Salary</code> table:
36+
<strong>输入:
37+
</strong><code>Salary</code> :
3738
+--------+-----------+----------+--------+---------------+
3839
| emp_id | firstname | lastname | salary | department_id |
3940
+--------+-----------+----------+--------+---------------+
@@ -48,7 +49,7 @@ Each row contains employees details and their yearly salaries, however, some of
4849
| 6 | Natasha | Swanson | 79632 | D1005 |
4950
| 6 | Natasha | Swanson | 90000 | D1005 |
5051
+--------+-----------+----------+--------+---------------+
51-
<strong>Output:
52+
<strong>输出:
5253
</strong>+--------+-----------+----------+--------+---------------+
5354
| emp_id | firstname | lastname | salary | department_id |
5455
+--------+-----------+----------+--------+---------------+
@@ -60,14 +61,13 @@ Each row contains employees details and their yearly salaries, however, some of
6061
| 6 | Natasha | Swanson | 90000 | D1005 |
6162
+--------+-----------+----------+--------+---------------+<strong>
6263
</strong>
63-
<strong>Explanation:</strong>
64-
- emp_id 1 has two records with a salary of&nbsp;110000, 106119 out of these 110000 is an updated salary (Assuming salary is increasing each year)
65-
- emp_id 2 has two records with a salary of&nbsp;128922, 128922&nbsp;out of these 130000 is an updated salary.
66-
- emp_id 3 has only one salary record so that is already an updated salary.
67-
- emp_id 4&nbsp;has two records with a salary of&nbsp;162825, 170000&nbsp;out of these 170000 is an updated salary.
68-
- emp_id 5&nbsp;has only one salary record so that is already an updated salary.
69-
- emp_id 6&nbsp;has two records with a salary of 79632, 90000 out&nbsp;of these 90000 is an updated salary.
70-
</pre>
64+
<strong>解释:</strong>
65+
- emp_id 1 有两条记录,工资分别为 110000 和 106119,其中 110000 是更新后的工资(假设工资每年都会增加)
66+
- emp_id 2 有两条记录,工资分别为 128922 和 128922,其中 130000 是更新后的工资。
67+
- emp_id 3 只有一条工资记录,因此这已经是更新后的工资。
68+
- emp_id 4 有两条记录,工资分别为 162825 和 170000,其中 170000 是更新后的工资。
69+
- emp_id 5 只有一条工资记录,因此这已经是更新后的工资。
70+
- emp_id 6 有两条记录,工资分别为 79632 和 90000,其中 90000 是更新后的工资。</pre>
7171

7272
## 解法
7373

solution/2600-2699/2669.Count Artist Occurrences On Spotify Ranking List/README.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,43 @@
66

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

9-
<p>Table: <code><font face="monospace">Spotify</font></code></p>
9+
<p>表:&nbsp;<code><font face="monospace">Spotify</font></code></p>
1010

1111
<pre>
1212
+-------------+---------+
13-
| Column Name | Type |
13+
| 列名 | 类型 |
1414
+-------------+---------+
1515
| id | int |
1616
| track_name | varchar |
1717
| artist | varchar |
1818
+-------------+---------+
19-
<code>id</code> is the primary Key for this table.
20-
Each row contains an id, track_name, and artist.
19+
id是该表的主键。
20+
每行包含 id、track_name artist
2121
</pre>
2222

23-
<p>Write an SQL query to find how many times each artist appeared on the spotify ranking list.</p>
23+
<p>编写一个SQL查询来查找每个艺术家在Spotify排行榜上出现的次数。</p>
2424

25-
<p>Return <em>the result table having the artist&#39;s name along with the corresponding number of occurrences&nbsp;ordered by occurrence count in&nbsp;<strong>descending </strong>order. If the occurrences are equal, then it&rsquo;s ordered by the artist&rsquo;s name in <strong>ascending</strong> order.</em></p>
25+
<p>返回结果表,其中包含艺术家的名称以及相应的出现次数,按出现次数<strong>降序</strong>排列。如果出现次数相等,则按艺术家名称<strong>升序</strong>排列。</p>
2626

27-
<p>The query result format is in the following example​​​​​​.</p>
27+
<p>查询结果格式如下所示:</p>
2828

2929
<p>&nbsp;</p>
30-
<p><strong class="example">Example 1:</strong></p>
30+
31+
<p><strong class="example">示例 1:</strong></p>
3132

3233
<pre>
33-
<strong>Input:
34-
</strong>Spotify table:
34+
<strong>输入:
35+
</strong>Spotify :
3536
+---------+--------------------+------------+
3637
| id | track_name | artist |
3738
+---------+--------------------+------------+
38-
| 303651 | Heart Won&#39;t Forget | Sia |
39+
| 303651 | Heart Won't Forget | Sia |
3940
| 1046089 | Shape of you | Ed Sheeran |
40-
| 33445 | I&#39;m the one | DJ Khalid |
41+
| 33445 | I'm the one | DJ Khalid |
4142
| 811266 | Young Dumb &amp; Broke | DJ Khalid |
4243
| 505727 | Happier | Ed Sheeran |
4344
+---------+--------------------+------------+
44-
<strong>Output:
45+
<strong>输出:
4546
</strong>+------------+-------------+
4647
| artist | occurrences |
4748
+------------+-------------+
@@ -50,7 +51,7 @@ Each row contains an id, track_name, and artist.
5051
| Sia | 1 |
5152
+------------+-------------+
5253

53-
<strong>Explanation: </strong>The count of occurrences is listed in descending order under the column name &quot;occurrences&quot;. If the number of occurrences is the same, the artist&#39;s names are sorted in ascending order.
54+
<strong>解释:</strong>"occurrences" 列下按降序列出了出现次数的计数。如果出现次数相同,则艺术家名称按升序排序。
5455
</pre>
5556

5657
## 解法

solution/bash_problem_readme_template.md

-25
This file was deleted.

solution/bash_problem_readme_template_en.md

-19
This file was deleted.

solution/contest_readme_template.md

-26
This file was deleted.

solution/contest_readme_template_en.md

-28
This file was deleted.

solution/problem_readme_template.md

-51
This file was deleted.

0 commit comments

Comments
 (0)