Skip to content

Commit 37516b7

Browse files
authored
chore: update lc problems (doocs#1379)
1 parent 9981d45 commit 37516b7

File tree

59 files changed

+423
-371
lines changed

Some content is hidden

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

59 files changed

+423
-371
lines changed

solution/0000-0099/0021.Merge Two Sorted Lists/README_EN.md

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

77
<p>You are given the heads of two sorted linked lists <code>list1</code> and <code>list2</code>.</p>
88

9-
<p>Merge the two lists in a one <strong>sorted</strong> list. The list should be made by splicing together the nodes of the first two lists.</p>
9+
<p>Merge the two lists into one <strong>sorted</strong> list. The list should be made by splicing together the nodes of the first two lists.</p>
1010

1111
<p>Return <em>the head of the merged linked list</em>.</p>
1212

solution/0100-0199/0104.Maximum Depth of Binary Tree/README.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,38 @@
66

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

9-
<p>给定一个二叉树,找出其最大深度。</p>
9+
<p>给定一个二叉树 <code>root</code> ,返回其最大深度。</p>
1010

11-
<p>二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。</p>
11+
<p>二叉树的 <strong>最大深度</strong> 是指从根节点到最远叶子节点的最长路径上的节点数。</p>
1212

13-
<p><strong>说明:</strong>&nbsp;叶子节点是指没有子节点的节点。</p>
13+
<p>&nbsp;</p>
1414

15-
<p><strong>示例:</strong><br>
16-
给定二叉树 <code>[3,9,20,null,null,15,7]</code>,</p>
15+
<p><strong>示例 1:</strong></p>
1716

18-
<pre> 3
19-
/ \
20-
9 20
21-
/ \
22-
15 7</pre>
17+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0100-0199/0104.Maximum%20Depth%20of%20Binary%20Tree/images/tmp-tree.jpg" style="width: 400px; height: 277px;" /></p>
2318

24-
<p>返回它的最大深度&nbsp;3 。</p>
19+
<p>&nbsp;</p>
20+
21+
<pre>
22+
<b>输入:</b>root = [3,9,20,null,null,15,7]
23+
<b>输出:</b>3
24+
</pre>
25+
26+
<p><strong>示例 2:</strong></p>
27+
28+
<pre>
29+
<b>输入:</b>root = [1,null,2]
30+
<b>输出:</b>2
31+
</pre>
32+
33+
<p>&nbsp;</p>
34+
35+
<p><strong>提示:</strong></p>
36+
37+
<ul>
38+
<li>树中节点的数量在&nbsp;<code>[0, 10<sup>4</sup>]</code>&nbsp;区间内。</li>
39+
<li><code>-100 &lt;= Node.val &lt;= 100</code></li>
40+
</ul>
2541

2642
## 解法
2743

solution/0100-0199/0180.Consecutive Numbers/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
| id | int |
1414
| num | varchar |
1515
+-------------+---------+
16-
id is the primary key for this table.
16+
In SQL, id is the primary key for this table.
1717
id is an autoincrement column.
1818
</pre>
1919

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

22-
<p>Write an SQL query to find all numbers that appear at least three times consecutively.</p>
22+
<p>Find all numbers that appear at least three times consecutively.</p>
2323

2424
<p>Return the result table in <strong>any order</strong>.</p>
2525

26-
<p>The query result format is in the following example.</p>
26+
<p>The&nbsp;result format is in the following example.</p>
2727

2828
<p>&nbsp;</p>
2929
<p><strong class="example">Example 1:</strong></p>

solution/0100-0199/0188.Best Time to Buy and Sell Stock IV/README.md

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

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

9-
<p>给定一个整数数组&nbsp;<code>prices</code> ,它的第<em> </em><code>i</code> 个元素&nbsp;<code>prices[i]</code> 是一支给定的股票在第 <code>i</code><em> </em>天的价格,和一个整型 <code>k</code> 。</p>
9+
<p>给你一个整数数组&nbsp;<code>prices</code> 和一个整数 <code>k</code> ,其中 <code>prices[i]</code> 是某支给定的股票在第 <code>i</code><em> </em>天的价格。</p>
1010

1111
<p>设计一个算法来计算你所能获取的最大利润。你最多可以完成 <code>k</code> 笔交易。也就是说,你最多可以买 <code>k</code> 次,卖 <code>k</code> 次。</p>
1212

@@ -34,8 +34,8 @@
3434
<p><strong>提示:</strong></p>
3535

3636
<ul>
37-
<li><code>0 &lt;= k &lt;= 100</code></li>
38-
<li><code>0 &lt;= prices.length &lt;= 1000</code></li>
37+
<li><code>1 &lt;= k &lt;= 100</code></li>
38+
<li><code>1 &lt;= prices.length &lt;= 1000</code></li>
3939
<li><code>0 &lt;= prices[i] &lt;= 1000</code></li>
4040
</ul>
4141

solution/0100-0199/0197.Rising Temperature/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
| recordDate | date |
1515
| temperature | int |
1616
+---------------+---------+
17-
id is the primary key for this table.
17+
In SQL, id is the primary key for this table.
1818
This table contains information about the temperature on a certain day.
1919
</pre>
2020

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

23-
<p>Write an SQL query to find all dates&#39; <code>Id</code> with higher temperatures compared to its previous dates (yesterday).</p>
23+
<p>Find all dates&#39; <code>Id</code> with higher temperatures compared to its previous dates (yesterday).</p>
2424

2525
<p>Return the result table in <strong>any order</strong>.</p>
2626

27-
<p>The query result format is in the following example.</p>
27+
<p>The result format is in the following example.</p>
2828

2929
<p>&nbsp;</p>
3030
<p><strong class="example">Example 1:</strong></p>

solution/0200-0299/0207.Course Schedule/README.md

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

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

9-
<p>你这个学期必须选修 <code>numCourses</code> 门课程,记为 <code>0</code> 到 <code>numCourses - 1</code> 。</p>
9+
<p>你这个学期必须选修 <code>numCourses</code> 门课程,记为&nbsp;<code>0</code>&nbsp;&nbsp;<code>numCourses - 1</code> 。</p>
1010

11-
<p>在选修某些课程之前需要一些先修课程。 先修课程按数组 <code>prerequisites</code> 给出,其中 <code>prerequisites[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> ,表示如果要学习课程 <code>a<sub>i</sub></code> 则 <strong>必须</strong> 先学习课程  <code>b<sub>i</sub></code><sub> </sub>。</p>
11+
<p>在选修某些课程之前需要一些先修课程。 先修课程按数组&nbsp;<code>prerequisites</code> 给出,其中&nbsp;<code>prerequisites[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> ,表示如果要学习课程&nbsp;<code>a<sub>i</sub></code> 则 <strong>必须</strong> 先学习课程&nbsp; <code>b<sub>i</sub></code><sub> </sub>。</p>
1212

1313
<ul>
14-
<li>例如,先修课程对 <code>[0, 1]</code> 表示:想要学习课程 <code>0</code> ,你需要先完成课程 <code>1</code> 。</li>
14+
<li>例如,先修课程对&nbsp;<code>[0, 1]</code> 表示:想要学习课程 <code>0</code> ,你需要先完成课程 <code>1</code> 。</li>
1515
</ul>
1616

1717
<p>请你判断是否可能完成所有课程的学习?如果可以,返回 <code>true</code> ;否则,返回 <code>false</code> 。</p>
1818

19-
<p> </p>
19+
<p>&nbsp;</p>
2020

2121
<p><strong>示例 1:</strong></p>
2222

@@ -32,15 +32,15 @@
3232
<strong>输出:</strong>false
3333
<strong>解释:</strong>总共有 2 门课程。学习课程 1 之前,你需要先完成​课程 0 ;并且学习课程 0 之前,你还应先完成课程 1 。这是不可能的。</pre>
3434

35-
<p> </p>
35+
<p>&nbsp;</p>
3636

3737
<p><strong>提示:</strong></p>
3838

3939
<ul>
40-
<li><code>1 <= numCourses <= 10<sup>5</sup></code></li>
41-
<li><code>0 <= prerequisites.length <= 5000</code></li>
40+
<li><code>1 &lt;= numCourses &lt;= 2000</code></li>
41+
<li><code>0 &lt;= prerequisites.length &lt;= 5000</code></li>
4242
<li><code>prerequisites[i].length == 2</code></li>
43-
<li><code>0 <= a<sub>i</sub>, b<sub>i</sub> < numCourses</code></li>
43+
<li><code>0 &lt;= a<sub>i</sub>, b<sub>i</sub> &lt; numCourses</code></li>
4444
<li><code>prerequisites[i]</code> 中的所有课程对 <strong>互不相同</strong></li>
4545
</ul>
4646

solution/0200-0299/0269.Alien Dictionary/README.md

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

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

9-
<p>现有一种使用英语字母的火星语言,这门语言的字母顺序与英语顺序不同。</p>
9+
<p>现有一种使用英语字母的火星语言,这门语言的字母顺序对你来说是未知的。</p>
1010

11-
<p>给你一个字符串列表 <code>words</code> ,作为这门语言的词典,<code>words</code> 中的字符串已经 <strong>按这门新语言的字母顺序进行了排序</strong> 。</p>
11+
<p>给你一个来自这种外星语言字典的字符串列表 <code>words</code> ,<code>words</code> 中的字符串已经 <strong>按这门新语言的字母顺序进行了排序</strong> 。</p>
1212

13-
<p>请你根据该词典还原出此语言中已知的字母顺序,并 <strong>按字母递增顺序</strong> 排列。若不存在合法字母顺序,返回 <code>""</code> 。若存在多种可能的合法字母顺序,返回其中 <strong>任意一种</strong> 顺序即可。</p>
13+
<p>如果这种说法是错误的,并且给出的 <code>words</code> 不能对应任何字母的顺序,则返回 <code>""</code> 。</p>
1414

15-
<p>字符串 <code>s</code> <strong>字典顺序小于</strong> 字符串 <code>t</code> 有两种情况:</p>
15+
<p>否则,返回一个按新语言规则的&nbsp;<strong>字典递增顺序 </strong>排序的独特字符串。如果有多个解决方案,则返回其中 <strong>任意一个</strong> </p>
1616

17-
<ul>
18-
<li>在第一个不同字母处,如果 <code>s</code> 中的字母在这门外星语言的字母顺序中位于 <code>t</code> 中字母之前,那么 <code>s</code> 的字典顺序小于 <code>t</code> 。</li>
19-
<li>如果前面 <code>min(s.length, t.length)</code> 字母都相同,那么 <code>s.length < t.length</code> 时,<code>s</code> 的字典顺序也小于 <code>t</code> 。</li>
20-
</ul>
21-
22-
<p> </p>
17+
<p>&nbsp;</p>
2318

2419
<p><strong>示例 1:</strong></p>
2520

@@ -43,13 +38,13 @@
4338
<strong>解释:</strong>不存在合法字母顺序,因此返回 <code>"" 。</code>
4439
</pre>
4540

46-
<p> </p>
41+
<p>&nbsp;</p>
4742

4843
<p><strong>提示:</strong></p>
4944

5045
<ul>
51-
<li><code>1 <= words.length <= 100</code></li>
52-
<li><code>1 <= words[i].length <= 100</code></li>
46+
<li><code>1 &lt;= words.length &lt;= 100</code></li>
47+
<li><code>1 &lt;= words[i].length &lt;= 100</code></li>
5348
<li><code>words[i]</code> 仅由小写英文字母组成</li>
5449
</ul>
5550

solution/0200-0299/0269.Alien Dictionary/README_EN.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
## Description
66

7-
<p>There is a new alien language that uses the English alphabet. However, the order among the letters is unknown to you.</p>
7+
<p>There is a new alien language that uses the English alphabet. However, the order of the letters is unknown to you.</p>
88

9-
<p>You are given a list of strings <code>words</code> from the alien language&#39;s dictionary, where the strings in <code>words</code> are <span data-keyword="lexicographically-smaller-string-alien"><strong>sorted lexicographically</strong></span> by the rules of this new language.</p>
9+
<p>You are given a list of strings <code>words</code> from the alien language&#39;s dictionary. Now it is claimed that the strings in <code>words</code> are <span data-keyword="lexicographically-smaller-string-alien"><strong>sorted lexicographically</strong></span> by the rules of this new language.</p>
1010

11-
<p>Return <em>a string of the unique letters in the new alien language sorted in <strong>lexicographically increasing order</strong> by the new language&#39;s rules. </em>If there is no solution, return <code>&quot;&quot;</code><em>. </em>If there are multiple solutions, return<em> <strong>any of them</strong></em>.</p>
11+
<p>If this claim is incorrect, and the given arrangement of string in&nbsp;<code>words</code>&nbsp;cannot correspond to any order of letters,&nbsp;return&nbsp;<code>&quot;&quot;.</code></p>
12+
13+
<p>Otherwise, return <em>a string of the unique letters in the new alien language sorted in <strong>lexicographically increasing order</strong> by the new language&#39;s rules</em><em>. </em>If there are multiple solutions, return<em> <strong>any of them</strong></em>.</p>
1214

1315
<p>&nbsp;</p>
1416
<p><strong class="example">Example 1:</strong></p>

solution/0300-0399/0309.Best Time to Buy and Sell Stock with Cooldown/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [309. 最佳买卖股票时机含冷冻期](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-with-cooldown)
1+
# [309. 买卖股票的最佳时机含冷冻期](https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-with-cooldown)
22

33
[English Version](/solution/0300-0399/0309.Best%20Time%20to%20Buy%20and%20Sell%20Stock%20with%20Cooldown/README_EN.md)
44

solution/0300-0399/0399.Evaluate Division/README_EN.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
<p><strong>Note:</strong> The input is always valid. You may assume that evaluating the queries will not result in division by zero and that there is no contradiction.</p>
1414

15+
<p><strong>Note:&nbsp;</strong>The variables that do not occur in the list of equations are undefined, so the answer cannot be determined for them.</p>
16+
1517
<p>&nbsp;</p>
1618
<p><strong class="example">Example 1:</strong></p>
1719

@@ -20,9 +22,9 @@
2022
<strong>Output:</strong> [6.00000,0.50000,-1.00000,1.00000,-1.00000]
2123
<strong>Explanation:</strong>
2224
Given: <em>a / b = 2.0</em>, <em>b / c = 3.0</em>
23-
queries are: <em>a / c = ?</em>, <em>b / a = ?</em>, <em>a / e = ?</em>, <em>a / a = ?</em>, <em>x / x = ?</em>
25+
queries are: <em>a / c = ?</em>, <em>b / a = ?</em>, <em>a / e = ?</em>, <em>a / a = ?</em>, <em>x / x = ? </em>
2426
return: [6.0, 0.5, -1.0, 1.0, -1.0 ]
25-
</pre>
27+
note: x is undefined =&gt; -1.0</pre>
2628

2729
<p><strong class="example">Example 2:</strong></p>
2830

0 commit comments

Comments
 (0)