Skip to content

Commit 44dc9b6

Browse files
committed
feat: update leetcode problems description
1 parent 90b3883 commit 44dc9b6

File tree

3,418 files changed

+74489
-74375
lines changed

Some content is hidden

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

3,418 files changed

+74489
-74375
lines changed

solution/0000-0099/0001.Two Sum/README.md

+37-6
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,49 @@
55
## 题目描述
66

77
<!-- 这里写题目描述 -->
8-
<p>给定一个整数数组 <code>nums</code>&nbsp;和一个目标值 <code>target</code>,请你在该数组中找出和为目标值的那&nbsp;<strong>两个</strong>&nbsp;整数,并返回他们的数组下标。</p>
98

10-
<p>你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。</p>
9+
<p>给定一个整数数组 <code>nums</code> 和一个整数目标值 <code>target</code>,请你在该数组中找出 <strong>和为目标值</strong> 的那 <strong>两个</strong> 整数,并返回它们的数组下标。</p>
1110

12-
<p><strong>示例:</strong></p>
11+
<p>你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。</p>
1312

14-
<pre>给定 nums = [2, 7, 11, 15], target = 9
13+
<p>你可以按任意顺序返回答案。</p>
1514

16-
因为 nums[<strong>0</strong>] + nums[<strong>1</strong>] = 2 + 7 = 9
17-
所以返回 [<strong>0, 1</strong>]
15+
<p> </p>
16+
17+
<p><strong>示例 1:</strong></p>
18+
19+
<pre>
20+
<strong>输入:</strong>nums = [2,7,11,15], target = 9
21+
<strong>输出:</strong>[0,1]
22+
<strong>解释:</strong>因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。
23+
</pre>
24+
25+
<p><strong>示例 2:</strong></p>
26+
27+
<pre>
28+
<strong>输入:</strong>nums = [3,2,4], target = 6
29+
<strong>输出:</strong>[1,2]
30+
</pre>
31+
32+
<p><strong>示例 3:</strong></p>
33+
34+
<pre>
35+
<strong>输入:</strong>nums = [3,3], target = 6
36+
<strong>输出:</strong>[0,1]
1837
</pre>
1938

39+
<p> </p>
40+
41+
<p><strong>提示:</strong></p>
42+
43+
<ul>
44+
<li><code>2 <= nums.length <= 10<sup>3</sup></code></li>
45+
<li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li>
46+
<li><code>-10<sup>9</sup> <= target <= 10<sup>9</sup></code></li>
47+
<li><strong>只会存在一个有效答案</strong></li>
48+
</ul>
49+
50+
2051
## 解法
2152

2253
<!-- 这里可写通用的实现逻辑 -->

solution/0000-0099/0001.Two Sum/README_EN.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,45 @@
44

55
## Description
66

7-
<p>Given an array of integers, return <strong>indices</strong> of the two numbers such that they add up to a specific target.</p>
7+
<p>Given an array of integers <code>nums</code>&nbsp;and an integer <code>target</code>, return <em>indices of the two numbers such that they add up to <code>target</code></em>.</p>
88

9-
<p>You may assume that each input would have <strong><em>exactly</em></strong> one solution, and you may not use the <em>same</em> element twice.</p>
9+
<p>You may assume that each input would have <strong><em>exactly</em> one solution</strong>, and you may not use the <em>same</em> element twice.</p>
1010

11-
<p><strong>Example:</strong></p>
11+
<p>You can return the answer in any order.</p>
12+
13+
<p>&nbsp;</p>
14+
<p><strong>Example 1:</strong></p>
1215

1316
<pre>
17+
<strong>Input:</strong> nums = [2,7,11,15], target = 9
18+
<strong>Output:</strong> [0,1]
19+
<strong>Output:</strong> Because nums[0] + nums[1] == 9, we return [0, 1].
20+
</pre>
1421

15-
Given nums = [2, 7, 11, 15], target = 9,
22+
<p><strong>Example 2:</strong></p>
23+
24+
<pre>
25+
<strong>Input:</strong> nums = [3,2,4], target = 6
26+
<strong>Output:</strong> [1,2]
27+
</pre>
1628

29+
<p><strong>Example 3:</strong></p>
1730

31+
<pre>
32+
<strong>Input:</strong> nums = [3,3], target = 6
33+
<strong>Output:</strong> [0,1]
34+
</pre>
1835

19-
Because nums[<strong>0</strong>] + nums[<strong>1</strong>] = 2 + 7 = 9,
36+
<p>&nbsp;</p>
37+
<p><strong>Constraints:</strong></p>
2038

21-
return [<strong>0</strong>, <strong>1</strong>].
39+
<ul>
40+
<li><code>2 &lt;= nums.length &lt;= 10<sup>3</sup></code></li>
41+
<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
42+
<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>
43+
<li><strong>Only one valid answer exists.</strong></li>
44+
</ul>
2245

23-
</pre>
2446

2547
## Solutions
2648

solution/0000-0099/0002.Add Two Numbers/README.md

+36-7
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,48 @@
55
## 题目描述
66

77
<!-- 这里写题目描述 -->
8-
<p>给出两个&nbsp;<strong>非空</strong> 的链表用来表示两个非负的整数。其中,它们各自的位数是按照&nbsp;<strong>逆序</strong>&nbsp;的方式存储的,并且它们的每个节点只能存储&nbsp;<strong>一位</strong>&nbsp;数字。</p>
98

10-
<p>如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。</p>
9+
<p>给你两个 <strong>非空</strong> 的链表,表示两个非负的整数。它们每位数字都是按照 <strong>逆序</strong> 的方式存储的,并且每个节点只能存储 <strong>一位</strong> 数字。</p>
1110

12-
<p>您可以假设除了数字 0 之外,这两个数都不会以 0&nbsp;开头。</p>
11+
<p>请你将两个数相加,并以相同形式返回一个表示和的链表。</p>
1312

14-
<p><strong>示例:</strong></p>
13+
<p>你可以假设除了数字 0 之外,这两个数都不会以 0 开头。</p>
1514

16-
<pre><strong>输入:</strong>(2 -&gt; 4 -&gt; 3) + (5 -&gt; 6 -&gt; 4)
17-
<strong>输出:</strong>7 -&gt; 0 -&gt; 8
18-
<strong>原因:</strong>342 + 465 = 807
15+
<p> </p>
16+
17+
<p><strong>示例 1:</strong></p>
18+
<img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2021/01/02/addtwonumber1.jpg" style="width: 483px; height: 342px;" />
19+
<pre>
20+
<strong>输入:</strong>l1 = [2,4,3], l2 = [5,6,4]
21+
<strong>输出:</strong>[7,0,8]
22+
<strong>解释:</strong>342 + 465 = 807.
23+
</pre>
24+
25+
<p><strong>示例 2:</strong></p>
26+
27+
<pre>
28+
<strong>输入:</strong>l1 = [0], l2 = [0]
29+
<strong>输出:</strong>[0]
1930
</pre>
2031

32+
<p><strong>示例 3:</strong></p>
33+
34+
<pre>
35+
<strong>输入:</strong>l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
36+
<strong>输出:</strong>[8,9,9,9,0,0,0,1]
37+
</pre>
38+
39+
<p> </p>
40+
41+
<p><strong>提示:</strong></p>
42+
43+
<ul>
44+
<li>每个链表中的节点数在范围 <code>[1, 100]</code> 内</li>
45+
<li><code>0 <= Node.val <= 9</code></li>
46+
<li>题目数据保证列表表示的数字不含前导零</li>
47+
</ul>
48+
49+
2150
## 解法
2251

2352
<!-- 这里可写通用的实现逻辑 -->

solution/0000-0099/0002.Add Two Numbers/README_EN.md

+27-6
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,43 @@
44

55
## Description
66

7-
<p>You are given two <b>non-empty</b> linked lists representing two non-negative integers. The digits are stored in <b>reverse order</b> and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.</p>
7+
<p>You are given two <strong>non-empty</strong> linked lists representing two non-negative integers. The digits are stored in <strong>reverse order</strong>, and each of their nodes contains a single digit. Add the two numbers and return the sum&nbsp;as a linked list.</p>
88

99
<p>You may assume the two numbers do not contain any leading zero, except the number 0 itself.</p>
1010

11-
<p><b>Example:</b></p>
12-
11+
<p>&nbsp;</p>
12+
<p><strong>Example 1:</strong></p>
13+
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/02/addtwonumber1.jpg" style="width: 483px; height: 342px;" />
1314
<pre>
15+
<strong>Input:</strong> l1 = [2,4,3], l2 = [5,6,4]
16+
<strong>Output:</strong> [7,0,8]
17+
<strong>Explanation:</strong> 342 + 465 = 807.
18+
</pre>
1419

15-
<b>Input:</b> (2 -&gt; 4 -&gt; 3) + (5 -&gt; 6 -&gt; 4)
20+
<p><strong>Example 2:</strong></p>
1621

17-
<b>Output:</b> 7 -&gt; 0 -&gt; 8
22+
<pre>
23+
<strong>Input:</strong> l1 = [0], l2 = [0]
24+
<strong>Output:</strong> [0]
25+
</pre>
1826

19-
<b>Explanation:</b> 342 + 465 = 807.
27+
<p><strong>Example 3:</strong></p>
2028

29+
<pre>
30+
<strong>Input:</strong> l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
31+
<strong>Output:</strong> [8,9,9,9,0,0,0,1]
2132
</pre>
2233

34+
<p>&nbsp;</p>
35+
<p><strong>Constraints:</strong></p>
36+
37+
<ul>
38+
<li>The number of nodes in each linked list is in the range <code>[1, 100]</code>.</li>
39+
<li><code>0 &lt;= Node.val &lt;= 9</code></li>
40+
<li>It is guaranteed that the list represents a number that does not have leading zeros.</li>
41+
</ul>
42+
43+
2344
## Solutions
2445

2546
<!-- tabs:start -->

solution/0000-0099/0003.Longest Substring Without Repeating Characters/README.md

+32-9
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,53 @@
55
## 题目描述
66

77
<!-- 这里写题目描述 -->
8-
<p>给定一个字符串,请你找出其中不含有重复字符的&nbsp;<strong>最长子串&nbsp;</strong>的长度。</p>
98

10-
<p><strong>示例&nbsp;1:</strong></p>
9+
<p>给定一个字符串,请你找出其中不含有重复字符的 <strong>最长子串 </strong>的长度。</p>
1110

12-
<pre><strong>输入: </strong>&quot;abcabcbb&quot;
11+
<p> </p>
12+
13+
<p><strong>示例 1:</strong></p>
14+
15+
<pre>
16+
<strong>输入: </strong>s = "abcabcbb"
1317
<strong>输出: </strong>3
14-
<strong>解释:</strong> 因为无重复字符的最长子串是 <code>&quot;abc&quot;,所以其</code>长度为 3。
18+
<strong>解释:</strong> 因为无重复字符的最长子串是 <code>"abc",所以其</code>长度为 3。
1519
</pre>
1620

1721
<p><strong>示例 2:</strong></p>
1822

19-
<pre><strong>输入: </strong>&quot;bbbbb&quot;
23+
<pre>
24+
<strong>输入: </strong>s = "bbbbb"
2025
<strong>输出: </strong>1
21-
<strong>解释: </strong>因为无重复字符的最长子串是 <code>&quot;b&quot;</code>,所以其长度为 1。
26+
<strong>解释: </strong>因为无重复字符的最长子串是 <code>"b"</code>,所以其长度为 1。
2227
</pre>
2328

2429
<p><strong>示例 3:</strong></p>
2530

26-
<pre><strong>输入: </strong>&quot;pwwkew&quot;
31+
<pre>
32+
<strong>输入: </strong>s = "pwwkew"
2733
<strong>输出: </strong>3
28-
<strong>解释: </strong>因为无重复字符的最长子串是&nbsp;<code>&quot;wke&quot;</code>,所以其长度为 3。
29-
&nbsp; 请注意,你的答案必须是 <strong>子串 </strong>的长度,<code>&quot;pwke&quot;</code>&nbsp;是一个<em>子序列,</em>不是子串。
34+
<strong>解释: </strong>因为无重复字符的最长子串是 <code>"wke"</code>,所以其长度为 3。
35+
  请注意,你的答案必须是 <strong>子串 </strong>的长度,<code>"pwke"</code> 是一个<em>子序列,</em>不是子串。
36+
</pre>
37+
38+
<p><strong>示例 4:</strong></p>
39+
40+
<pre>
41+
<strong>输入: </strong>s = ""
42+
<strong>输出: </strong>0
3043
</pre>
3144

45+
<p> </p>
46+
47+
<p><strong>提示:</strong></p>
48+
49+
<ul>
50+
<li><code>0 <= s.length <= 5 * 10<sup>4</sup></code></li>
51+
<li><code>s</code> 由英文字母、数字、符号和空格组成</li>
52+
</ul>
53+
54+
3255
## 解法
3356

3457
<!-- 这里可写通用的实现逻辑 -->

solution/0000-0099/0003.Longest Substring Without Repeating Characters/README_EN.md

+23-31
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,49 @@
44

55
## Description
66

7-
<p>Given a string, find the length of the <b>longest substring</b> without repeating characters.</p>
8-
9-
<div>
7+
<p>Given a string <code>s</code>, find the length of the <b>longest substring</b> without repeating characters.</p>
108

9+
<p>&nbsp;</p>
1110
<p><strong>Example 1:</strong></p>
1211

1312
<pre>
14-
15-
<strong>Input: </strong><span id="example-input-1-1">&quot;abcabcbb&quot;</span>
16-
17-
<strong>Output: </strong><span id="example-output-1">3
18-
19-
<strong>Explanation:</strong></span> The answer is <code>&quot;abc&quot;</code>, with the length of 3.
20-
13+
<strong>Input:</strong> s = &quot;abcabcbb&quot;
14+
<strong>Output:</strong> 3
15+
<strong>Explanation:</strong> The answer is &quot;abc&quot;, with the length of 3.
2116
</pre>
2217

23-
<div>
24-
2518
<p><strong>Example 2:</strong></p>
2619

2720
<pre>
28-
29-
<strong>Input: </strong><span id="example-input-2-1">&quot;bbbbb&quot;</span>
30-
31-
<strong>Output: </strong><span id="example-output-2">1
32-
33-
</span><span id="example-output-1"><strong>Explanation: </strong>T</span>he answer is <code>&quot;b&quot;</code>, with the length of 1.
34-
21+
<strong>Input:</strong> s = &quot;bbbbb&quot;
22+
<strong>Output:</strong> 1
23+
<strong>Explanation:</strong> The answer is &quot;b&quot;, with the length of 1.
3524
</pre>
3625

37-
<div>
38-
3926
<p><strong>Example 3:</strong></p>
4027

4128
<pre>
29+
<strong>Input:</strong> s = &quot;pwwkew&quot;
30+
<strong>Output:</strong> 3
31+
<strong>Explanation:</strong> The answer is &quot;wke&quot;, with the length of 3.
32+
Notice that the answer must be a substring, &quot;pwke&quot; is a subsequence and not a substring.
33+
</pre>
4234

43-
<strong>Input: </strong><span id="example-input-3-1">&quot;pwwkew&quot;</span>
44-
45-
<strong>Output: </strong><span id="example-output-3">3
46-
47-
</span><span id="example-output-1"><strong>Explanation: </strong></span>The answer is <code>&quot;wke&quot;</code>, with the length of 3.
48-
49-
Note that the answer must be a <b>substring</b>, <code>&quot;pwke&quot;</code> is a <i>subsequence</i> and not a substring.
35+
<p><strong>Example 4:</strong></p>
5036

37+
<pre>
38+
<strong>Input:</strong> s = &quot;&quot;
39+
<strong>Output:</strong> 0
5140
</pre>
5241

53-
</div>
42+
<p>&nbsp;</p>
43+
<p><strong>Constraints:</strong></p>
5444

55-
</div>
45+
<ul>
46+
<li><code>0 &lt;= s.length &lt;= 5 * 10<sup>4</sup></code></li>
47+
<li><code>s</code> consists of English letters, digits, symbols and spaces.</li>
48+
</ul>
5649

57-
</div>
5850

5951
## Solutions
6052

0 commit comments

Comments
 (0)