Skip to content

Commit 3a876ec

Browse files
authored
feat: update lc problems (doocs#3454)
1 parent 7cf45ae commit 3a876ec

File tree

62 files changed

+955
-258
lines changed

Some content is hidden

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

62 files changed

+955
-258
lines changed

solution/0000-0099/0020.Valid Parentheses/README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,37 @@ tags:
2929

3030
<p>&nbsp;</p>
3131

32-
<p><strong>示例 1:</strong></p>
32+
<p><strong class="example">示例 1:</strong></p>
3333

34-
<pre>
35-
<strong>输入:</strong>s = "()"
36-
<strong>输出:</strong>true
37-
</pre>
34+
<div class="example-block">
35+
<p><span class="example-io"><b>输入:</b>s = "()"</span></p>
3836

39-
<p><strong>示例&nbsp;2:</strong></p>
37+
<p><span class="example-io"><b>输出:</b>true</span></p>
38+
</div>
4039

41-
<pre>
42-
<strong>输入:</strong>s = "()[]{}"
43-
<strong>输出:</strong>true
44-
</pre>
40+
<p><strong class="example">示例 2:</strong></p>
4541

46-
<p><strong>示例&nbsp;3:</strong></p>
42+
<div class="example-block">
43+
<p><span class="example-io"><b>输入:</b>s = "()[]{}"</span></p>
4744

48-
<pre>
49-
<strong>输入:</strong>s = "(]"
50-
<strong>输出:</strong>false
51-
</pre>
45+
<p><span class="example-io"><b>输出:</b>true</span></p>
46+
</div>
47+
48+
<p><strong class="example">示例 3:</strong></p>
49+
50+
<div class="example-block">
51+
<p><span class="example-io"><b>输入:</b>s = "(]"</span></p>
52+
53+
<p><span class="example-io"><b>输出:</b>false</span></p>
54+
</div>
55+
56+
<p><strong class="example">示例 4:</strong></p>
57+
58+
<div class="example-block">
59+
<p><span class="example-io"><b>输入:</b>s = "([])"</span></p>
60+
61+
<p><span class="example-io"><b>输出:</b>true</span></p>
62+
</div>
5263

5364
<p>&nbsp;</p>
5465

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ tags:
2727
| id | int |
2828
| salary | int |
2929
+-------------+------+
30-
在 SQL 中,id 是这个表的主键。
30+
id 是这个表的主键。
3131
表的每一行包含员工的工资信息。
3232
</pre>
3333

3434
<p>&nbsp;</p>
3535

36-
<p>查询并返回 <code>Employee</code>&nbsp;表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 <code>null(Pandas 则返回 None)</code> 。</p>
36+
<p>查询并返回 <code>Employee</code>&nbsp;表中第二高的 <b>不同</b>&nbsp;薪水 。如果不存在第二高的薪水,查询应该返回 <code>null(Pandas 则返回 None)</code> 。</p>
3737

3838
<p>查询结果如下例所示。</p>
3939

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Each row of this table contains information about the salary of an employee.
3131

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

34-
<p>Write a solution to 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>
34+
<p>Write a solution to find&nbsp;the second highest <strong>distinct</strong> 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>
3535

3636
<p>The result format is in the following example.</p>
3737

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This table contains information about the temperature on a certain day.
3333

3434
<p>&nbsp;</p>
3535

36-
<p>Write a solution to find all dates&#39; <code>Id</code> with higher temperatures compared to its previous dates (yesterday).</p>
36+
<p>Write a solution to find all dates&#39; <code>id</code> with higher temperatures compared to its previous dates (yesterday).</p>
3737

3838
<p>Return the result table in <strong>any order</strong>.</p>
3939

solution/0200-0299/0205.Isomorphic Strings/README_EN.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,42 @@ tags:
2525

2626
<p>&nbsp;</p>
2727
<p><strong class="example">Example 1:</strong></p>
28-
<pre><strong>Input:</strong> s = "egg", t = "add"
29-
<strong>Output:</strong> true
30-
</pre><p><strong class="example">Example 2:</strong></p>
31-
<pre><strong>Input:</strong> s = "foo", t = "bar"
32-
<strong>Output:</strong> false
33-
</pre><p><strong class="example">Example 3:</strong></p>
34-
<pre><strong>Input:</strong> s = "paper", t = "title"
35-
<strong>Output:</strong> true
36-
</pre>
28+
29+
<div class="example-block">
30+
<p><strong>Input:</strong> <span class="example-io">s = &quot;egg&quot;, t = &quot;add&quot;</span></p>
31+
32+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
33+
34+
<p><strong>Explanation:</strong></p>
35+
36+
<p>The strings <code>s</code> and <code>t</code> can be made identical by:</p>
37+
38+
<ul>
39+
<li>Mapping <code>&#39;e&#39;</code> to <code>&#39;a&#39;</code>.</li>
40+
<li>Mapping <code>&#39;g&#39;</code> to <code>&#39;d&#39;</code>.</li>
41+
</ul>
42+
</div>
43+
44+
<p><strong class="example">Example 2:</strong></p>
45+
46+
<div class="example-block">
47+
<p><strong>Input:</strong> <span class="example-io">s = &quot;foo&quot;, t = &quot;bar&quot;</span></p>
48+
49+
<p><strong>Output:</strong> <span class="example-io">false</span></p>
50+
51+
<p><strong>Explanation:</strong></p>
52+
53+
<p>The strings <code>s</code> and <code>t</code> can not be made identical as <code>&#39;o&#39;</code> needs to be mapped to both <code>&#39;a&#39;</code> and <code>&#39;r&#39;</code>.</p>
54+
</div>
55+
56+
<p><strong class="example">Example 3:</strong></p>
57+
58+
<div class="example-block">
59+
<p><strong>Input:</strong> <span class="example-io">s = &quot;paper&quot;, t = &quot;title&quot;</span></p>
60+
61+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
62+
</div>
63+
3764
<p>&nbsp;</p>
3865
<p><strong>Constraints:</strong></p>
3966

solution/0200-0299/0242.Valid Anagram/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ tags:
2020

2121
<p>给定两个字符串 <code><em>s</em></code> 和 <code><em>t</em></code> ,编写一个函数来判断 <code><em>t</em></code> 是否是 <code><em>s</em></code> 的字母异位词。</p>
2222

23-
<p><strong>注意:</strong>若 <code><em>s</em></code> 和 <code><em>t</em></code><em> </em>中每个字符出现的次数都相同,则称 <code><em>s</em></code> 和 <code><em>t</em></code><em> </em>互为字母异位词。</p>
23+
<p><strong>字母异位词</strong> 是通过重新排列不同单词或短语的字母而形成的单词或短语,通常只使用所有原始字母一次。</p>
2424

25-
<p> </p>
25+
<p>&nbsp;</p>
2626

27-
<p><strong>示例 1:</strong></p>
27+
<p><strong>示例&nbsp;1:</strong></p>
2828

2929
<pre>
3030
<strong>输入:</strong> <em>s</em> = "anagram", <em>t</em> = "nagaram"
@@ -37,18 +37,18 @@ tags:
3737
<strong>输入:</strong> <em>s</em> = "rat", <em>t</em> = "car"
3838
<strong>输出: </strong>false</pre>
3939

40-
<p> </p>
40+
<p>&nbsp;</p>
4141

4242
<p><strong>提示:</strong></p>
4343

4444
<ul>
45-
<li><code>1 <= s.length, t.length <= 5 * 10<sup>4</sup></code></li>
46-
<li><code>s</code> 和 <code>t</code> 仅包含小写字母</li>
45+
<li><code>1 &lt;= s.length, t.length &lt;= 5 * 10<sup>4</sup></code></li>
46+
<li><code>s</code> 和 <code>t</code>&nbsp;仅包含小写字母</li>
4747
</ul>
4848

49-
<p> </p>
49+
<p>&nbsp;</p>
5050

51-
<p><strong>进阶: </strong>如果输入字符串包含 unicode 字符怎么办?你能否调整你的解法来应对这种情况?</p>
51+
<p><strong>进阶:&nbsp;</strong>如果输入字符串包含 unicode 字符怎么办?你能否调整你的解法来应对这种情况?</p>
5252

5353
<!-- description:end -->
5454

solution/0400-0499/0455.Assign Cookies/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tags:
2121

2222
<p>假设你是一位很棒的家长,想要给你的孩子们一些小饼干。但是,每个孩子最多只能给一块饼干。</p>
2323

24-
<p>对每个孩子 <code>i</code>,都有一个胃口值&nbsp;<code>g[i]</code><sub>,</sub>这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 <code>j</code>,都有一个尺寸 <code>s[j]</code><sub>&nbsp;</sub>。如果 <code>s[j]&nbsp;&gt;= g[i]</code>,我们可以将这个饼干 <code>j</code> 分配给孩子 <code>i</code> ,这个孩子会得到满足。你的目标是尽可能满足越多数量的孩子,并输出这个最大数值。</p>
24+
<p>对每个孩子 <code>i</code>,都有一个胃口值&nbsp;<code>g[i]</code><sub>,</sub>这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 <code>j</code>,都有一个尺寸 <code>s[j]</code><sub>&nbsp;</sub>。如果 <code>s[j]&nbsp;&gt;= g[i]</code>,我们可以将这个饼干 <code>j</code> 分配给孩子 <code>i</code> ,这个孩子会得到满足。你的目标是满足尽可能多的孩子,并输出这个最大数值。</p>
2525
&nbsp;
2626

2727
<p><strong>示例&nbsp;1:</strong></p>

solution/0500-0599/0592.Fraction Addition and Subtraction/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tags:
2020

2121
<p>给定一个表示分数加减运算的字符串&nbsp;<code>expression</code>&nbsp;,你需要返回一个字符串形式的计算结果。&nbsp;</p>
2222

23-
<p>这个结果应该是不可约分的分数,即<a href="https://baike.baidu.com/item/%E6%9C%80%E7%AE%80%E5%88%86%E6%95%B0" target="_blank">最简分数</a>。&nbsp;如果最终结果是一个整数,例如&nbsp;<code>2</code>,你需要将它转换成分数形式,其分母为&nbsp;<code>1</code>。所以在上述例子中, <code>2</code>&nbsp;应该被转换为&nbsp;<code>2/1</code>。</p>
23+
<p>这个结果应该是不可约分的分数,即&nbsp;<a href="https://baike.baidu.com/item/%E6%9C%80%E7%AE%80%E5%88%86%E6%95%B0" target="_blank">最简分数</a>。&nbsp;如果最终结果是一个整数,例如&nbsp;<code>2</code>,你需要将它转换成分数形式,其分母为&nbsp;<code>1</code>。所以在上述例子中, <code>2</code>&nbsp;应该被转换为&nbsp;<code>2/1</code>。</p>
2424

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

@@ -52,9 +52,9 @@ tags:
5252
<ul>
5353
<li>输入和输出字符串只包含&nbsp;<code>'0'</code> 到&nbsp;<code>'9'</code>&nbsp;的数字,以及&nbsp;<code>'/'</code>, <code>'+'</code> 和&nbsp;<code>'-'</code>。&nbsp;</li>
5454
<li>输入和输出分数格式均为&nbsp;<code>±分子/分母</code>。如果输入的第一个分数或者输出的分数是正数,则&nbsp;<code>'+'</code>&nbsp;会被省略掉。</li>
55-
<li>输入只包含合法的<strong>最简分数</strong>,每个分数的<strong>分子</strong>与<strong>分母</strong>的范围是&nbsp;&nbsp;[1,10]。&nbsp;如果分母是1,意味着这个分数实际上是一个整数。</li>
55+
<li>输入只包含合法的&nbsp;<strong>最简分数</strong>,每个分数的<strong>分子</strong>与<strong>分母</strong>的范围是&nbsp;<code>[1,10]</code>。&nbsp;如果分母是 1,意味着这个分数实际上是一个整数。</li>
5656
<li>输入的分数个数范围是 [1,10]。</li>
57-
<li><strong>最终结果</strong>的分子与分母保证是 32 位整数范围内的有效整数。</li>
57+
<li><strong>最终结果&nbsp;</strong>的分子与分母保证是 32 位整数范围内的有效整数。</li>
5858
</ul>
5959

6060
<!-- description:end -->

solution/0600-0699/0626.Exchange Seats/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tags:
2727
+-------------+---------+
2828
<code>id</code> 是该表的主键(唯一值)列。
2929
该表的每一行都表示学生的姓名和 ID。
30-
id 是一个连续的增量
30+
ID 序列始终从 1 开始并连续增加
3131
</pre>
3232

3333
<p>&nbsp;</p>

solution/0600-0699/0673.Number of Longest Increasing Subsequence/README_EN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ tags:
4646
<ul>
4747
<li><code>1 &lt;= nums.length &lt;= 2000</code></li>
4848
<li><code>-10<sup>6</sup> &lt;= nums[i] &lt;= 10<sup>6</sup></code></li>
49+
<li>The answer is guaranteed to fit inside a 32-bit integer.</li>
4950
</ul>
5051

5152
<!-- description:end -->

0 commit comments

Comments
 (0)