Skip to content

Commit 5a338eb

Browse files
committed
LeetCode 付费题目描述 201~400
1 parent 1da59b9 commit 5a338eb

File tree

122 files changed

+3431
-122
lines changed

Some content is hidden

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

122 files changed

+3431
-122
lines changed

solution/0200-0299/0243.Shortest Word Distance/README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@
44

55
## 题目描述
66
<!-- 这里写题目描述 -->
7-
None
7+
<p>给定一个单词列表和两个单词 <em>word1</em> 和 <em>word2</em>,返回列表中这两个单词之间的最短距离。</p>
8+
9+
<p><strong>示例:</strong><br>
10+
假设 words = <code>["practice", "makes", "perfect", "coding", "makes"]</code></p>
11+
12+
<pre><strong>输入:</strong> <em>word1</em> = <code>“coding”</code>, <em>word2</em> = <code>“practice”</code>
13+
<strong>输出:</strong> 3
14+
</pre>
15+
16+
<pre><strong>输入:</strong> <em>word1</em> = <code>"makes"</code>, <em>word2</em> = <code>"coding"</code>
17+
<strong>输出:</strong> 1
18+
</pre>
19+
20+
<p><strong>注意:</strong><br>
21+
你可以假设 <em>word1</em> 不等于 <em>word2</em>, 并且 <em>word1</em> 和 <em>word2</em> 都在列表里。</p>
22+
823

924

1025
## 解法

solution/0200-0299/0243.Shortest Word Distance/README_EN.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@
33
[中文文档](/solution/0200-0299/0243.Shortest%20Word%20Distance/README.md)
44

55
## Description
6-
None
6+
<p>Given a list of words and two words <em>word1</em> and <em>word2</em>, return the shortest distance between these two words in the list.</p>
7+
8+
<p><strong>Example:</strong><br />
9+
Assume that words = <code>["practice", "makes", "perfect", "coding", "makes"]</code>.</p>
10+
11+
<pre>
12+
<b>Input:</b> <em>word1</em> = <code>“coding”</code>, <em>word2</em> = <code>“practice”</code>
13+
<b>Output:</b> 3
14+
</pre>
15+
16+
<pre>
17+
<b>Input:</b> <em>word1</em> = <code>"makes"</code>, <em>word2</em> = <code>"coding"</code>
18+
<b>Output:</b> 1
19+
</pre>
20+
21+
<p><strong>Note:</strong><br />
22+
You may assume that <em>word1</em> <strong>does not equal to</strong> <em>word2</em>, and <em>word1</em> and <em>word2</em> are both in the list.</p>
23+
724

825

926
## Solutions

solution/0200-0299/0244.Shortest Word Distance II/README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@
44

55
## 题目描述
66
<!-- 这里写题目描述 -->
7-
None
7+
<p>请设计一个类,使该类的构造函数能够接收一个单词列表。然后再实现一个方法,该方法能够分别接收两个单词 <em>word1</em> 和 <em>word2,</em>并返回列表中这两个单词之间的最短距离。您的方法将被以不同的参数调用 <em>多次</em>。</p>
8+
9+
<p><strong>示例:</strong><br>
10+
假设 words = <code>["practice", "makes", "perfect", "coding", "makes"]</code></p>
11+
12+
<pre><strong>输入:</strong> <em>word1</em> = <code>“coding”</code>, <em>word2</em> = <code>“practice”</code>
13+
<strong>输出:</strong> 3
14+
</pre>
15+
16+
<pre><strong>输入:</strong> <em>word1</em> = <code>"makes"</code>, <em>word2</em> = <code>"coding"</code>
17+
<strong>输出:</strong> 1</pre>
18+
19+
<p><strong>注意:</strong><br>
20+
你可以假设 <em>word1</em> <strong>不等于</strong> <em>word2</em>, 并且 <em>word1</em> 和 <em>word2</em> 都在列表里。</p>
21+
822

923

1024
## 解法

solution/0200-0299/0244.Shortest Word Distance II/README_EN.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,23 @@
33
[中文文档](/solution/0200-0299/0244.Shortest%20Word%20Distance%20II/README.md)
44

55
## Description
6-
None
6+
<p>Design a class which receives a list of words in the constructor, and implements a method that takes two words <em>word1</em> and <em>word2</em> and return the shortest distance between these two words in the list. Your method will be called <em>repeatedly</em> many times with different parameters. </p>
7+
8+
<p><strong>Example:</strong><br />
9+
Assume that words = <code>["practice", "makes", "perfect", "coding", "makes"]</code>.</p>
10+
11+
<pre>
12+
<b>Input:</b> <em>word1</em> = <code>“coding”</code>, <em>word2</em> = <code>“practice”</code>
13+
<b>Output:</b> 3
14+
</pre>
15+
16+
<pre>
17+
<b>Input:</b> <em>word1</em> = <code>"makes"</code>, <em>word2</em> = <code>"coding"</code>
18+
<b>Output:</b> 1</pre>
19+
20+
<p><strong>Note:</strong><br />
21+
You may assume that <em>word1</em> <strong>does not equal to</strong> <em>word2</em>, and <em>word1</em> and <em>word2</em> are both in the list.</p>
22+
723

824

925
## Solutions

solution/0200-0299/0245.Shortest Word Distance III/README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,24 @@
44

55
## 题目描述
66
<!-- 这里写题目描述 -->
7-
None
7+
<p>给定一个单词列表和两个单词 <em>word1</em> 和 <em>word2</em>,返回列表中这两个单词之间的最短距离。</p>
8+
9+
<p><em>word1</em> 和 <em>word2</em> 是有可能相同的,并且它们将分别表示为列表中两个独立的单词。</p>
10+
11+
<p><strong>示例:</strong><br>
12+
假设 words = <code>["practice", "makes", "perfect", "coding", "makes"]</code>.</p>
13+
14+
<pre><strong>输入:</strong> <em>word1</em> = <code>“makes”</code>, <em>word2</em> = <code>“coding”</code>
15+
<strong>输出:</strong> 1
16+
</pre>
17+
18+
<pre><strong>输入:</strong> <em>word1</em> = <code>"makes"</code>, <em>word2</em> = <code>"makes"</code>
19+
<strong>输出:</strong> 3
20+
</pre>
21+
22+
<p><strong>注意:</strong><br>
23+
你可以假设 <em>word1</em> 和 <em>word2</em> 都在列表里。</p>
24+
825

926

1027
## 解法

solution/0200-0299/0245.Shortest Word Distance III/README_EN.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,26 @@
33
[中文文档](/solution/0200-0299/0245.Shortest%20Word%20Distance%20III/README.md)
44

55
## Description
6-
None
6+
<p>Given a list of words and two words <em>word1</em> and <em>word2</em>, return the shortest distance between these two words in the list.</p>
7+
8+
<p><em>word1</em> and <em>word2</em> may be the same and they represent two individual words in the list.</p>
9+
10+
<p><strong>Example:</strong><br />
11+
Assume that words = <code>["practice", "makes", "perfect", "coding", "makes"]</code>.</p>
12+
13+
<pre>
14+
<b>Input:</b> <em>word1</em> = <code>“makes”</code>, <em>word2</em> = <code>“coding”</code>
15+
<b>Output:</b> 1
16+
</pre>
17+
18+
<pre>
19+
<b>Input:</b> <em>word1</em> = <code>"makes"</code>, <em>word2</em> = <code>"makes"</code>
20+
<b>Output:</b> 3
21+
</pre>
22+
23+
<p><strong>Note:</strong><br />
24+
You may assume <em>word1</em> and <em>word2</em> are both in the list.</p>
25+
726

827

928
## Solutions

solution/0200-0299/0246.Strobogrammatic Number/README.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,34 @@
44

55
## 题目描述
66
<!-- 这里写题目描述 -->
7-
None
7+
<p>中心对称数是指一个数字在旋转了 180 度之后看起来依旧相同的数字(或者上下颠倒地看)。</p>
8+
9+
<p>请写一个函数来判断该数字是否是中心对称数,其输入将会以一个字符串的形式来表达数字。</p>
10+
11+
<p> </p>
12+
13+
<p><strong>示例 1:</strong></p>
14+
15+
<pre><strong>输入:</strong> num = "69"
16+
<strong>输出:</strong> true
17+
</pre>
18+
19+
<p><strong>示例 2:</strong></p>
20+
21+
<pre><strong>输入:</strong> num = "88"
22+
<strong>输出:</strong> true</pre>
23+
24+
<p><strong>示例 3:</strong></p>
25+
26+
<pre><strong>输入:</strong> num = "962"
27+
<strong>输出:</strong> false</pre>
28+
29+
<p><strong>示例 4:</strong></p>
30+
31+
<pre><strong>输入:</strong>num = "1"
32+
<strong>输出:</strong>true
33+
</pre>
34+
835

936

1037
## 解法

solution/0200-0299/0246.Strobogrammatic Number/README_EN.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@
33
[中文文档](/solution/0200-0299/0246.Strobogrammatic%20Number/README.md)
44

55
## Description
6-
None
6+
<p>A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).</p>
7+
8+
<p>Write a function to determine if a number is strobogrammatic. The number is represented as a string.</p>
9+
10+
<p> </p>
11+
<p><strong>Example 1:</strong></p>
12+
<pre><strong>Input:</strong> num = "69"
13+
<strong>Output:</strong> true
14+
</pre><p><strong>Example 2:</strong></p>
15+
<pre><strong>Input:</strong> num = "88"
16+
<strong>Output:</strong> true
17+
</pre><p><strong>Example 3:</strong></p>
18+
<pre><strong>Input:</strong> num = "962"
19+
<strong>Output:</strong> false
20+
</pre><p><strong>Example 4:</strong></p>
21+
<pre><strong>Input:</strong> num = "1"
22+
<strong>Output:</strong> true
23+
</pre>
724

825

926
## Solutions

solution/0200-0299/0248.Strobogrammatic Number III/README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@
44

55
## 题目描述
66
<!-- 这里写题目描述 -->
7-
None
7+
<p>中心对称数是指一个数字在旋转了 180 度之后看起来依旧相同的数字(或者上下颠倒地看)。</p>
8+
9+
<p>写一个函数来计算范围在 [low, high] 之间中心对称数的个数。</p>
10+
11+
<p><strong>示例:</strong></p>
12+
13+
<pre><strong>输入:</strong> low = "50", high = "100"
14+
<strong>输出:</strong> 3
15+
<strong>解释: </strong>69,88 和 96 是三个在该范围内的中心对称数</pre>
16+
17+
<p><strong>注意:</strong><br>
18+
由于范围可能很大,所以 low 和 high 都用字符串表示。</p>
19+
820

921

1022
## 解法

solution/0200-0299/0248.Strobogrammatic Number III/README_EN.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@
33
[中文文档](/solution/0200-0299/0248.Strobogrammatic%20Number%20III/README.md)
44

55
## Description
6-
None
6+
<p>A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).</p>
7+
8+
<p>Write a function to count the total strobogrammatic numbers that exist in the range of low <= num <= high.</p>
9+
10+
<p><b>Example:</b></p>
11+
12+
<pre>
13+
<b>Input:</b> low = "50", high = "100"
14+
<b>Output:</b> 3
15+
<strong>Explanation: </strong>69, 88, and 96 are three strobogrammatic numbers.</pre>
16+
17+
<p><strong>Note:</strong><br />
18+
Because the range might be a large number, the <em>low</em> and <em>high</em> numbers are represented as string.</p>
19+
720

821

922
## Solutions

solution/0200-0299/0249.Group Shifted Strings/README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,26 @@
44

55
## 题目描述
66
<!-- 这里写题目描述 -->
7-
None
7+
<p>给定一个字符串,对该字符串可以进行 “移位” 的操作,也就是将字符串中每个字母都变为其在字母表中后续的字母,比如:<code>"abc" -> "bcd"</code>。这样,我们可以持续进行 “移位” 操作,从而生成如下移位序列:</p>
8+
9+
<pre>"abc" -> "bcd" -> ... -> "xyz"</pre>
10+
11+
<p>给定一个包含仅小写字母字符串的列表,将该列表中所有满足 “移位” 操作规律的组合进行分组并返回。</p>
12+
13+
<p> </p>
14+
15+
<p><strong>示例:</strong></p>
16+
17+
<pre><strong>输入:</strong><code>["abc", "bcd", "acef", "xyz", "az", "ba", "a", "z"]</code>
18+
<strong>输出:</strong>
19+
[
20+
["abc","bcd","xyz"],
21+
["az","ba"],
22+
["acef"],
23+
["a","z"]
24+
]
25+
<strong>解释:</strong>可以认为字母表首尾相接,所以 'z' 的后续为 'a',所以 ["az","ba"] 也满足 “移位” 操作规律。</pre>
26+
827

928

1029
## 解法

solution/0200-0299/0249.Group Shifted Strings/README_EN.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,26 @@
33
[中文文档](/solution/0200-0299/0249.Group%20Shifted%20Strings/README.md)
44

55
## Description
6-
None
6+
<p>Given a string, we can "shift" each of its letter to its successive letter, for example: <code>"abc" -> "bcd"</code>. We can keep "shifting" which forms the sequence:</p>
7+
8+
<pre>
9+
"abc" -> "bcd" -> ... -> "xyz"</pre>
10+
11+
<p>Given a list of <strong>non-empty</strong> strings which contains only lowercase alphabets, group all strings that belong to the same shifting sequence.</p>
12+
13+
<p><b>Example:</b></p>
14+
15+
<pre>
16+
<b>Input:</b> <code>["abc", "bcd", "acef", "xyz", "az", "ba", "a", "z"],</code>
17+
<b>Output:</b>
18+
[
19+
["abc","bcd","xyz"],
20+
["az","ba"],
21+
["acef"],
22+
["a","z"]
23+
]
24+
</pre>
25+
726

827

928
## Solutions

solution/0200-0299/0250.Count Univalue Subtrees/README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,23 @@
44

55
## 题目描述
66
<!-- 这里写题目描述 -->
7-
None
7+
<p>给定一个二叉树,统计该二叉树数值相同的子树个数。</p>
8+
9+
<p>同值子树是指该子树的所有节点都拥有相同的数值。</p>
10+
11+
<p><strong>示例:</strong></p>
12+
13+
<pre><strong>输入: </strong>root = [5,1,5,5,5,null,5]
14+
15+
5
16+
/ \
17+
1 5
18+
/ \ \
19+
5 5 5
20+
21+
<strong>输出:</strong> 4
22+
</pre>
23+
824

925

1026
## 解法

solution/0200-0299/0250.Count Univalue Subtrees/README_EN.md

+34-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,40 @@
33
[中文文档](/solution/0200-0299/0250.Count%20Univalue%20Subtrees/README.md)
44

55
## Description
6-
None
6+
<p>Given the <code>root</code> of a binary tree, return the number of <strong>uni-value</strong> subtrees.</p>
7+
8+
<p>A <strong>uni-value subtree</strong> means all nodes of the subtree have the same value.</p>
9+
10+
<p> </p>
11+
<p><strong>Example 1:</strong></p>
12+
<img alt="" src="https://assets.leetcode.com/uploads/2020/08/21/unival_e1.jpg" style="width: 450px; height: 258px;" />
13+
<pre>
14+
<strong>Input:</strong> root = [5,1,5,5,5,null,5]
15+
<strong>Output:</strong> 4
16+
</pre>
17+
18+
<p><strong>Example 2:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> root = []
22+
<strong>Output:</strong> 0
23+
</pre>
24+
25+
<p><strong>Example 3:</strong></p>
26+
27+
<pre>
28+
<strong>Input:</strong> root = [5,5,5,5,5,null,5]
29+
<strong>Output:</strong> 6
30+
</pre>
31+
32+
<p> </p>
33+
<p><strong>Constraints:</strong></p>
34+
35+
<ul>
36+
<li>The numbrt of the node in the tree will be in the range <code>[0, 1000]</code>.</li>
37+
<li><code>-1000 <= Node.val <= 1000</code></li>
38+
</ul>
39+
740

841

942
## Solutions

0 commit comments

Comments
 (0)