Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e3780b7

Browse files
feat: update lc problems (doocs#3286)
1 parent da21eee commit e3780b7

File tree

32 files changed

+183
-92
lines changed

32 files changed

+183
-92
lines changed

‎solution/0000-0099/0013.Roman to Integer/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ M 1000</pre>
8787
<li>题目数据保证 <code>s</code> 是一个有效的罗马数字,且表示整数在范围 <code>[1, 3999]</code> 内</li>
8888
<li>题目所给测试用例皆符合罗马数字书写规则,不会出现跨位等情况。</li>
8989
<li>IL 和 IM 这样的例子并不符合题目要求,49 应该写作 XLIX,999 应该写作 CMXCIX 。</li>
90-
<li>关于罗马数字的详尽书写规则,可以参考 <a href="https://b2b.partcommunity.com/community/knowledge/zh_CN/detail/10753/%E7%BD%97%E9%A9%AC%E6%95%B0%E5%AD%97#knowledge_article">罗马数字 - Mathematics </a>。</li>
90+
<li>关于罗马数字的详尽书写规则,可以参考 <a href="https://baike.baidu.com/item/%E7%BD%97%E9%A9%AC%E6%95%B0%E5%AD%97/772296">罗马数字 - 百度百科</a>。</li>
9191
</ul>
9292

9393
<!-- description:end -->

‎solution/0000-0099/0091.Decode Ways/README.md‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,25 @@ tags:
1919

2020
<p>一条包含字母&nbsp;<code>A-Z</code> 的消息通过以下映射进行了 <strong>编码</strong> :</p>
2121

22-
<pre>
23-
'A' -&gt; "1"
24-
'B' -&gt; "2"
25-
...
26-
'Z' -&gt; "26"</pre>
22+
<p><code>"1" -&gt; 'A'<br />
23+
"2" -&gt; 'B'<br />
24+
...<br />
25+
"25" -&gt; 'Y'<br />
26+
"26" -&gt; 'Z'</code></p>
27+
28+
<p>然而,在&nbsp;<strong>解码</strong> 已编码的消息时,你意识到有许多不同的方式来解码,因为有些编码被包含在其它编码当中(<code>"2"</code> 和 <code>"5"</code> 与 <code>"25"</code>)。</p>
2729

28-
<p>要 <strong>解码</strong> 已编码的消息,所有数字必须基于上述映射的方法,反向映射回字母(可能有多种方法)。例如,<code>"11106"</code> 可以映射为:</p>
30+
<p>例如,<code>"11106"</code> 可以映射为:</p>
2931

3032
<ul>
31-
<li><code>"AAJF"</code> ,将消息分组为 <code>(1 1 10 6)</code></li>
32-
<li><code>"KJF"</code> ,将消息分组为 <code>(11 10 6)</code></li>
33+
<li><code>"AAJF"</code> ,将消息分组为 <code>(1, 1, 10, 6)</code></li>
34+
<li><code>"KJF"</code> ,将消息分组为 <code>(11, 10, 6)</code></li>
35+
<li>消息不能分组为&nbsp; <code>(1, 11, 06)</code> ,因为 <code>"06"</code>&nbsp;不是一个合法编码(只有 "6" 是合法的)。</li>
3336
</ul>
3437

35-
<p>注意,消息不能分组为&nbsp; <code>(1 11 06)</code> ,因为 <code>"06"</code> 不能映射为 <code>"F"</code> ,这是由于 <code>"6"</code> 和 <code>"06"</code> 在映射中并不等价。</p>
38+
<p>注意,可能存在无法解码的字符串。</p>
3639

37-
<p>给你一个只含数字的 <strong>非空 </strong>字符串 <code>s</code> ,请计算并返回 <strong>解码</strong> 方法的 <strong>总数</strong> 。</p>
40+
<p>给你一个只含数字的 <strong>非空 </strong>字符串 <code>s</code> ,请计算并返回 <strong>解码</strong> 方法的 <strong>总数</strong> 。如果没有合法的方式解码整个字符串,返回 <code>0</code>。</p>
3841

3942
<p>题目数据保证答案肯定是一个 <strong>32 位</strong> 的整数。</p>
4043

‎solution/0900-0999/0999.Available Captures for Rook/README.md‎

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,59 +18,58 @@ tags:
1818

1919
<!-- description:start -->
2020

21-
<p>在一个 8 x 8 的棋盘上,有一个白色的车(<code>Rook</code>),用字符 <code>&#39;R&#39;</code> 表示。棋盘上还可能存在空方块,白色的象(<code>Bishop</code>)以及黑色的卒(<code>pawn</code>),分别用字符 <code>&#39;.&#39;</code>,<code>&#39;B&#39;</code><code>&#39;p&#39;</code> 表示。不难看出,大写字符表示的是白棋,小写字符表示的是黑棋。</p>
21+
<p>给定一个&nbsp;<code>8 x 8</code> 的棋盘,<strong>只有一个</strong> 白色的车,用字符 <code>'R'</code> 表示。棋盘上还可能存在白色的象&nbsp;<code>'B'</code>&nbsp;以及黑色的卒&nbsp;<code>'p'</code>。空方块用字符 <code>'.'</code>&nbsp;表示。</p>
2222

23-
<p>车按国际象棋中的规则移动。东,西,南,北四个基本方向任选其一,然后一直向选定的方向移动,直到满足下列四个条件之一:</p>
23+
<p>车可以按水平或竖直方向(上,下,左,右)移动任意个方格直到它遇到另一个棋子或棋盘的边界。如果它能够在一次移动中移动到棋子的方格,则能够 <strong>吃掉</strong> 棋子。</p>
2424

25-
<ul>
26-
<li>棋手选择主动停下来。</li>
27-
<li>棋子因到达棋盘的边缘而停下。</li>
28-
<li>棋子移动到某一方格来捕获位于该方格上敌方(黑色)的卒,停在该方格内。</li>
29-
<li>车不能进入/越过已经放有其他友方棋子(白色的象)的方格,停在友方棋子前。</li>
30-
</ul>
25+
<p>注意:车不能穿过其它棋子,比如象和卒。这意味着如果有其它棋子挡住了路径,车就不能够吃掉棋子。</p>
3126

32-
<p>你现在可以控制车移动一次,请你统计有多少敌方的卒处于你的捕获范围内(即,可以被一步捕获的棋子数)。</p>
27+
<p>返回白车将能 <strong>吃掉</strong> 的 <strong>卒的数量</strong>。</p>
3328

3429
<p>&nbsp;</p>
3530

3631
<p><strong>示例 1:</strong></p>
3732

38-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_1_improved.png" style="height: 305px; width: 300px;"></p>
33+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_1_improved.png" style="height: 305px; width: 300px;" /></p>
3934

40-
<pre><strong>输入:</strong>[[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;R&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;p&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;]]
35+
<pre>
36+
<strong>输入:</strong>[[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","R",".",".",".","p"],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
4137
<strong>输出:</strong>3
4238
<strong>解释:
43-
</strong>在本例中,车能够捕获所有的卒
39+
</strong>在本例中,车能够吃掉所有的卒
4440
</pre>
4541

4642
<p><strong>示例 2:</strong></p>
4743

48-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_2_improved.png" style="height: 306px; width: 300px;"></p>
44+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_2_improved.png" style="height: 306px; width: 300px;" /></p>
4945

50-
<pre><strong>输入:</strong>[[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;p&quot;,&quot;p&quot;,&quot;p&quot;,&quot;p&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;p&quot;,&quot;p&quot;,&quot;B&quot;,&quot;p&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;p&quot;,&quot;B&quot;,&quot;R&quot;,&quot;B&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;p&quot;,&quot;p&quot;,&quot;B&quot;,&quot;p&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;p&quot;,&quot;p&quot;,&quot;p&quot;,&quot;p&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;]]
46+
<pre>
47+
<strong>输入:</strong>[[".",".",".",".",".",".",".","."],[".","p","p","p","p","p",".","."],[".","p","p","B","p","p",".","."],[".","p","B","R","B","p",".","."],[".","p","p","B","p","p",".","."],[".","p","p","p","p","p",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]]
5148
<strong>输出:</strong>0
5249
<strong>解释:
53-
</strong>象阻止了车捕获任何卒
50+
</strong>象阻止了车吃掉任何卒
5451
</pre>
5552

5653
<p><strong>示例 3:</strong></p>
5754

58-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_3_improved.png" style="height: 305px; width: 300px;"></p>
55+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0900-0999/0999.Available%20Captures%20for%20Rook/images/1253_example_3_improved.png" style="height: 305px; width: 300px;" /></p>
5956

60-
<pre><strong>输入:</strong>[[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;p&quot;,&quot;p&quot;,&quot;.&quot;,&quot;R&quot;,&quot;.&quot;,&quot;p&quot;,&quot;B&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;B&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;p&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;],[&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;,&quot;.&quot;]]
57+
<pre>
58+
<strong>输入:</strong>[[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","p",".",".",".","."],["p","p",".","R",".","p","B","."],[".",".",".",".",".",".",".","."],[".",".",".","B",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."]]
6159
<strong>输出:</strong>3
6260
<strong>解释: </strong>
63-
车可以捕获位置 b5,d6 和 f5 的卒。
61+
车可以吃掉位置 b5,d6 和 f5 的卒。
6462
</pre>
6563

6664
<p>&nbsp;</p>
6765

6866
<p><strong>提示:</strong></p>
6967

7068
<ol>
71-
<li><code>board.length == board[i].length == 8</code></li>
72-
<li><code>board[i][j]</code> 可以是&nbsp;<code>&#39;R&#39;</code>,<code>&#39;.&#39;</code>,<code>&#39;B&#39;</code>&nbsp;或&nbsp;<code>&#39;p&#39;</code></li>
73-
<li>只有一个格子上存在&nbsp;<code>board[i][j] == &#39;R&#39;</code></li>
69+
<li><code>board.length == 8</code></li>
70+
<li><code>board[i].length == 8</code></li>
71+
<li><code>board[i][j]</code> 可以是&nbsp;<code>'R'</code>,<code>'.'</code>,<code>'B'</code>&nbsp;或&nbsp;<code>'p'</code></li>
72+
<li>只有一个格子上存在&nbsp;<code>board[i][j] == 'R'</code></li>
7473
</ol>
7574

7675
<!-- description:end -->

‎solution/1700-1799/1788.Maximize the Beauty of the Garden/README.md‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/1700-1799/1788.Ma
55
tags:
66
- 贪心
77
- 数组
8+
- 哈希表
89
- 前缀和
910
---
1011

@@ -18,7 +19,7 @@ tags:
1819

1920
<!-- description:start -->
2021

21-
<p>有一个花园,有<code>n</code>朵花,这些花都有一个用整数表示的美观度。这些花被种在一条线上。给定一个长度为 <code>n</code> 的整数类型数组<code>flowers</code>,每一个<code>flowers[i]</code>表示第<code>i</code>朵花的美观度。</p>
22+
<p>有一个花园,有&nbsp;<code>n</code>&nbsp;朵花,这些花都有一个用整数表示的美观度。这些花被种在一条线上。给定一个长度为 <code>n</code> 的整数类型数组&nbsp;<code>flowers</code>&nbsp;,每一个&nbsp;<code>flowers[i]</code>&nbsp;表示第&nbsp;<code>i</code>&nbsp;朵花的美观度。</p>
2223

2324
<p>一个花园满足下列条件时,该花园是<strong>有效</strong>的。</p>
2425

@@ -31,29 +32,32 @@ tags:
3132

3233
<p>返回你去除了任意朵花(也可以不去除任意一朵)之后形成的<strong>有效</strong>花园中最大可能的美观度。</p>
3334

34-
<p></p>
35+
<p>&nbsp;</p>
3536

36-
<p><b>示例 1:</b></p>
37+
<p><bclass="example">示例 1:</b></p>
3738

38-
<pre><strong>输入:</strong> flowers = [1,2,3,1,2]
39+
<pre>
40+
<strong>输入:</strong> flowers = [1,2,3,1,2]
3941
<strong>输出:</strong> 8
4042
<strong>解释:</strong> 你可以修整为有效花园 [2,3,1,2] 来达到总美观度 2 +たす 3 +たす 1 +たす 2 = 8。</pre>
4143

42-
<p><strong>示例 2:</strong></p>
44+
<p><strongclass="example">示例 2:</strong></p>
4345

44-
<pre><strong>输入:</strong> flowers = [100,1,1,-3,1]
46+
<pre>
47+
<strong>输入:</strong> flowers = [100,1,1,-3,1]
4548
<strong>输出:</strong> 3
4649
<strong>解释:</strong> 你可以修整为有效花园 [1,1,1] 来达到总美观度 1 + 1 + 1 = 3。
4750
</pre>
4851

49-
<p><strong>示例 3:</strong></p>
52+
<p><strongclass="example">示例 3:</strong></p>
5053

51-
<pre><strong>输入:</strong> flowers = [-1,-2,0,-1]
54+
<pre>
55+
<strong>输入:</strong> flowers = [-1,-2,0,-1]
5256
<strong>输出:</strong> -2
5357
<strong>解释:</strong> 你可以修整为有效花园 [-1,-1] 来达到总美观度 -1 + -1 = -2。
5458
</pre>
5559

56-
<p></p>
60+
<p>&nbsp;</p>
5761

5862
<p><b>提示:</b></p>
5963

‎solution/1700-1799/1788.Maximize the Beauty of the Garden/README_EN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/1700-1799/1788.Ma
55
tags:
66
- Greedy
77
- Array
8+
- Hash Table
89
- Prefix Sum
910
---
1011

‎solution/1900-1999/1938.Maximum Genetic Difference Query/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ rating: 2502
66
source: 第 250 场周赛 Q4
77
tags:
88
- 位运算
9+
- 深度优先搜索
910
- 字典树
1011
- 数组
12+
- 哈希表
1113
---
1214

1315
<!-- problem:start -->

‎solution/1900-1999/1938.Maximum Genetic Difference Query/README_EN.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ rating: 2502
66
source: Weekly Contest 250 Q4
77
tags:
88
- Bit Manipulation
9+
- Depth-First Search
910
- Trie
1011
- Array
12+
- Hash Table
1113
---
1214

1315
<!-- problem:start -->

‎solution/2300-2399/2384.Largest Palindromic Number/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ tags:
88
- 贪心
99
- 哈希表
1010
- 字符串
11+
- 计数
1112
---
1213

1314
<!-- problem:start -->

‎solution/2300-2399/2384.Largest Palindromic Number/README_EN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ tags:
88
- Greedy
99
- Hash Table
1010
- String
11+
- Counting
1112
---
1213

1314
<!-- problem:start -->

‎solution/2500-2599/2597.The Number of Beautiful Subsets/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ rating: 2023
66
source: 第 337 场周赛 Q3
77
tags:
88
- 数组
9+
- 哈希表
10+
- 数学
911
- 动态规划
1012
- 回溯
13+
- 组合数学
1114
- 排序
1215
---
1316

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /