Skip to content

Commit 9195406

Browse files
committed
feat: update lc problems
1 parent ee2728e commit 9195406

File tree

2,502 files changed

+6397
-5657
lines changed

Some content is hidden

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

2,502 files changed

+6397
-5657
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
<p>You can return the answer in any order.</p>
1212

1313
<p>&nbsp;</p>
14-
<p><strong>Example 1:</strong></p>
14+
<p><strong class="example">Example 1:</strong></p>
1515

1616
<pre>
1717
<strong>Input:</strong> nums = [2,7,11,15], target = 9
1818
<strong>Output:</strong> [0,1]
1919
<strong>Explanation:</strong> Because nums[0] + nums[1] == 9, we return [0, 1].
2020
</pre>
2121

22-
<p><strong>Example 2:</strong></p>
22+
<p><strong class="example">Example 2:</strong></p>
2323

2424
<pre>
2525
<strong>Input:</strong> nums = [3,2,4], target = 6
2626
<strong>Output:</strong> [1,2]
2727
</pre>
2828

29-
<p><strong>Example 3:</strong></p>
29+
<p><strong class="example">Example 3:</strong></p>
3030

3131
<pre>
3232
<strong>Input:</strong> nums = [3,3], target = 6

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
<p>You may assume the two numbers do not contain any leading zero, except the number 0 itself.</p>
1010

1111
<p>&nbsp;</p>
12-
<p><strong>Example 1:</strong></p>
12+
<p><strong class="example">Example 1:</strong></p>
1313
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0002.Add%20Two%20Numbers/images/addtwonumber1.jpg" style="width: 483px; height: 342px;" />
1414
<pre>
1515
<strong>Input:</strong> l1 = [2,4,3], l2 = [5,6,4]
1616
<strong>Output:</strong> [7,0,8]
1717
<strong>Explanation:</strong> 342 + 465 = 807.
1818
</pre>
1919

20-
<p><strong>Example 2:</strong></p>
20+
<p><strong class="example">Example 2:</strong></p>
2121

2222
<pre>
2323
<strong>Input:</strong> l1 = [0], l2 = [0]
2424
<strong>Output:</strong> [0]
2525
</pre>
2626

27-
<p><strong>Example 3:</strong></p>
27+
<p><strong class="example">Example 3:</strong></p>
2828

2929
<pre>
3030
<strong>Input:</strong> l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
<p>Given a string <code>s</code>, find the length of the <strong>longest substring</strong> without repeating characters.</p>
88

99
<p>&nbsp;</p>
10-
<p><strong>Example 1:</strong></p>
10+
<p><strong class="example">Example 1:</strong></p>
1111

1212
<pre>
1313
<strong>Input:</strong> s = &quot;abcabcbb&quot;
1414
<strong>Output:</strong> 3
1515
<strong>Explanation:</strong> The answer is &quot;abc&quot;, with the length of 3.
1616
</pre>
1717

18-
<p><strong>Example 2:</strong></p>
18+
<p><strong class="example">Example 2:</strong></p>
1919

2020
<pre>
2121
<strong>Input:</strong> s = &quot;bbbbb&quot;
2222
<strong>Output:</strong> 1
2323
<strong>Explanation:</strong> The answer is &quot;b&quot;, with the length of 1.
2424
</pre>
2525

26-
<p><strong>Example 3:</strong></p>
26+
<p><strong class="example">Example 3:</strong></p>
2727

2828
<pre>
2929
<strong>Input:</strong> s = &quot;pwwkew&quot;

solution/0000-0099/0004.Median of Two Sorted Arrays/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
<p>The overall run time complexity should be <code>O(log (m+n))</code>.</p>
1010

1111
<p>&nbsp;</p>
12-
<p><strong>Example 1:</strong></p>
12+
<p><strong class="example">Example 1:</strong></p>
1313

1414
<pre>
1515
<strong>Input:</strong> nums1 = [1,3], nums2 = [2]
1616
<strong>Output:</strong> 2.00000
1717
<strong>Explanation:</strong> merged array = [1,2,3] and median is 2.
1818
</pre>
1919

20-
<p><strong>Example 2:</strong></p>
20+
<p><strong class="example">Example 2:</strong></p>
2121

2222
<pre>
2323
<strong>Input:</strong> nums1 = [1,2], nums2 = [3,4]

solution/0000-0099/0005.Longest Palindromic Substring/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
<p>A string is called a palindrome string if the reverse of that string is the same as the original string.</p>
1010

1111
<p>&nbsp;</p>
12-
<p><strong>Example 1:</strong></p>
12+
<p><strong class="example">Example 1:</strong></p>
1313

1414
<pre>
1515
<strong>Input:</strong> s = &quot;babad&quot;
1616
<strong>Output:</strong> &quot;bab&quot;
1717
<strong>Explanation:</strong> &quot;aba&quot; is also a valid answer.
1818
</pre>
1919

20-
<p><strong>Example 2:</strong></p>
20+
<p><strong class="example">Example 2:</strong></p>
2121

2222
<pre>
2323
<strong>Input:</strong> s = &quot;cbbd&quot;

solution/0000-0099/0006.Zigzag Conversion/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ string convert(string s, int numRows);
2121
</pre>
2222

2323
<p>&nbsp;</p>
24-
<p><strong>Example 1:</strong></p>
24+
<p><strong class="example">Example 1:</strong></p>
2525

2626
<pre>
2727
<strong>Input:</strong> s = &quot;PAYPALISHIRING&quot;, numRows = 3
2828
<strong>Output:</strong> &quot;PAHNAPLSIIGYIR&quot;
2929
</pre>
3030

31-
<p><strong>Example 2:</strong></p>
31+
<p><strong class="example">Example 2:</strong></p>
3232

3333
<pre>
3434
<strong>Input:</strong> s = &quot;PAYPALISHIRING&quot;, numRows = 4
@@ -40,7 +40,7 @@ Y A H R
4040
P I
4141
</pre>
4242

43-
<p><strong>Example 3:</strong></p>
43+
<p><strong class="example">Example 3:</strong></p>
4444

4545
<pre>
4646
<strong>Input:</strong> s = &quot;A&quot;, numRows = 1

solution/0000-0099/0007.Reverse Integer/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
<p><strong>Assume the environment does not allow you to store 64-bit integers (signed or unsigned).</strong></p>
1010

1111
<p>&nbsp;</p>
12-
<p><strong>Example 1:</strong></p>
12+
<p><strong class="example">Example 1:</strong></p>
1313

1414
<pre>
1515
<strong>Input:</strong> x = 123
1616
<strong>Output:</strong> 321
1717
</pre>
1818

19-
<p><strong>Example 2:</strong></p>
19+
<p><strong class="example">Example 2:</strong></p>
2020

2121
<pre>
2222
<strong>Input:</strong> x = -123
2323
<strong>Output:</strong> -321
2424
</pre>
2525

26-
<p><strong>Example 3:</strong></p>
26+
<p><strong class="example">Example 3:</strong></p>
2727

2828
<pre>
2929
<strong>Input:</strong> x = 120

solution/0000-0099/0008.String to Integer (atoi)/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</ul>
2626

2727
<p>&nbsp;</p>
28-
<p><strong>Example 1:</strong></p>
28+
<p><strong class="example">Example 1:</strong></p>
2929

3030
<pre>
3131
<strong>Input:</strong> s = &quot;42&quot;
@@ -41,7 +41,7 @@ The parsed integer is 42.
4141
Since 42 is in the range [-2<sup>31</sup>, 2<sup>31</sup> - 1], the final result is 42.
4242
</pre>
4343

44-
<p><strong>Example 2:</strong></p>
44+
<p><strong class="example">Example 2:</strong></p>
4545

4646
<pre>
4747
<strong>Input:</strong> s = &quot; -42&quot;
@@ -57,7 +57,7 @@ The parsed integer is -42.
5757
Since -42 is in the range [-2<sup>31</sup>, 2<sup>31</sup> - 1], the final result is -42.
5858
</pre>
5959

60-
<p><strong>Example 3:</strong></p>
60+
<p><strong class="example">Example 3:</strong></p>
6161

6262
<pre>
6363
<strong>Input:</strong> s = &quot;4193 with words&quot;

solution/0000-0099/0009.Palindrome Number/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
</ul>
1414

1515
<p>&nbsp;</p>
16-
<p><strong>Example 1:</strong></p>
16+
<p><strong class="example">Example 1:</strong></p>
1717

1818
<pre>
1919
<strong>Input:</strong> x = 121
2020
<strong>Output:</strong> true
2121
<strong>Explanation:</strong> 121 reads as 121 from left to right and from right to left.
2222
</pre>
2323

24-
<p><strong>Example 2:</strong></p>
24+
<p><strong class="example">Example 2:</strong></p>
2525

2626
<pre>
2727
<strong>Input:</strong> x = -121
2828
<strong>Output:</strong> false
2929
<strong>Explanation:</strong> From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
3030
</pre>
3131

32-
<p><strong>Example 3:</strong></p>
32+
<p><strong class="example">Example 3:</strong></p>
3333

3434
<pre>
3535
<strong>Input:</strong> x = 10

solution/0000-0099/0010.Regular Expression Matching/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
<p>The matching should cover the <strong>entire</strong> input string (not partial).</p>
1515

1616
<p>&nbsp;</p>
17-
<p><strong>Example 1:</strong></p>
17+
<p><strong class="example">Example 1:</strong></p>
1818

1919
<pre>
2020
<strong>Input:</strong> s = &quot;aa&quot;, p = &quot;a&quot;
2121
<strong>Output:</strong> false
2222
<strong>Explanation:</strong> &quot;a&quot; does not match the entire string &quot;aa&quot;.
2323
</pre>
2424

25-
<p><strong>Example 2:</strong></p>
25+
<p><strong class="example">Example 2:</strong></p>
2626

2727
<pre>
2828
<strong>Input:</strong> s = &quot;aa&quot;, p = &quot;a*&quot;
2929
<strong>Output:</strong> true
3030
<strong>Explanation:</strong> &#39;*&#39; means zero or more of the preceding element, &#39;a&#39;. Therefore, by repeating &#39;a&#39; once, it becomes &quot;aa&quot;.
3131
</pre>
3232

33-
<p><strong>Example 3:</strong></p>
33+
<p><strong class="example">Example 3:</strong></p>
3434

3535
<pre>
3636
<strong>Input:</strong> s = &quot;ab&quot;, p = &quot;.*&quot;

solution/0000-0099/0011.Container With Most Water/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<p><strong>Notice</strong> that you may not slant the container.</p>
1414

1515
<p>&nbsp;</p>
16-
<p><strong>Example 1:</strong></p>
16+
<p><strong class="example">Example 1:</strong></p>
1717
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0011.Container%20With%20Most%20Water/images/question_11.jpg" style="width: 600px; height: 287px;" />
1818
<pre>
1919
<strong>Input:</strong> height = [1,8,6,2,5,4,8,3,7]
2020
<strong>Output:</strong> 49
2121
<strong>Explanation:</strong> The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.
2222
</pre>
2323

24-
<p><strong>Example 2:</strong></p>
24+
<p><strong class="example">Example 2:</strong></p>
2525

2626
<pre>
2727
<strong>Input:</strong> height = [1,1]

solution/0000-0099/0012.Integer to Roman/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ M 1000</pre>
2929
<p>Given an integer, convert it to a roman numeral.</p>
3030

3131
<p>&nbsp;</p>
32-
<p><strong>Example 1:</strong></p>
32+
<p><strong class="example">Example 1:</strong></p>
3333

3434
<pre>
3535
<strong>Input:</strong> num = 3
3636
<strong>Output:</strong> &quot;III&quot;
3737
<strong>Explanation:</strong> 3 is represented as 3 ones.
3838
</pre>
3939

40-
<p><strong>Example 2:</strong></p>
40+
<p><strong class="example">Example 2:</strong></p>
4141

4242
<pre>
4343
<strong>Input:</strong> num = 58
4444
<strong>Output:</strong> &quot;LVIII&quot;
4545
<strong>Explanation:</strong> L = 50, V = 5, III = 3.
4646
</pre>
4747

48-
<p><strong>Example 3:</strong></p>
48+
<p><strong class="example">Example 3:</strong></p>
4949

5050
<pre>
5151
<strong>Input:</strong> num = 1994

solution/0000-0099/0013.Roman to Integer/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ M 1000</pre>
2929
<p>Given a roman numeral, convert it to an integer.</p>
3030

3131
<p>&nbsp;</p>
32-
<p><strong>Example 1:</strong></p>
32+
<p><strong class="example">Example 1:</strong></p>
3333

3434
<pre>
3535
<strong>Input:</strong> s = &quot;III&quot;
3636
<strong>Output:</strong> 3
3737
<strong>Explanation:</strong> III = 3.
3838
</pre>
3939

40-
<p><strong>Example 2:</strong></p>
40+
<p><strong class="example">Example 2:</strong></p>
4141

4242
<pre>
4343
<strong>Input:</strong> s = &quot;LVIII&quot;
4444
<strong>Output:</strong> 58
4545
<strong>Explanation:</strong> L = 50, V= 5, III = 3.
4646
</pre>
4747

48-
<p><strong>Example 3:</strong></p>
48+
<p><strong class="example">Example 3:</strong></p>
4949

5050
<pre>
5151
<strong>Input:</strong> s = &quot;MCMXCIV&quot;

solution/0000-0099/0014.Longest Common Prefix/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ end
184184
* @param {string[]} strs
185185
* @return {string}
186186
*/
187-
var longestCommonPrefix = function(strs) {
187+
var longestCommonPrefix = function (strs) {
188188
for (let j = 0; j < strs[0].length; j++) {
189189
for (let i = 0; i < strs.length; i++) {
190190
if (strs[0][j] !== strs[i][j]) {

solution/0000-0099/0014.Longest Common Prefix/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
<p>If there is no common prefix, return an empty string <code>&quot;&quot;</code>.</p>
1010

1111
<p>&nbsp;</p>
12-
<p><strong>Example 1:</strong></p>
12+
<p><strong class="example">Example 1:</strong></p>
1313

1414
<pre>
1515
<strong>Input:</strong> strs = [&quot;flower&quot;,&quot;flow&quot;,&quot;flight&quot;]
1616
<strong>Output:</strong> &quot;fl&quot;
1717
</pre>
1818

19-
<p><strong>Example 2:</strong></p>
19+
<p><strong class="example">Example 2:</strong></p>
2020

2121
<pre>
2222
<strong>Input:</strong> strs = [&quot;dog&quot;,&quot;racecar&quot;,&quot;car&quot;]
@@ -175,7 +175,7 @@ end
175175
* @param {string[]} strs
176176
* @return {string}
177177
*/
178-
var longestCommonPrefix = function(strs) {
178+
var longestCommonPrefix = function (strs) {
179179
for (let j = 0; j < strs[0].length; j++) {
180180
for (let i = 0; i < strs.length; i++) {
181181
if (strs[0][j] !== strs[i][j]) {

solution/0000-0099/0015.3Sum/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p>Notice that the solution set must not contain duplicate triplets.</p>
1010

1111
<p>&nbsp;</p>
12-
<p><strong>Example 1:</strong></p>
12+
<p><strong class="example">Example 1:</strong></p>
1313

1414
<pre>
1515
<strong>Input:</strong> nums = [-1,0,1,2,-1,-4]
@@ -22,15 +22,15 @@ The distinct triplets are [-1,0,1] and [-1,-1,2].
2222
Notice that the order of the output and the order of the triplets does not matter.
2323
</pre>
2424

25-
<p><strong>Example 2:</strong></p>
25+
<p><strong class="example">Example 2:</strong></p>
2626

2727
<pre>
2828
<strong>Input:</strong> nums = [0,1,1]
2929
<strong>Output:</strong> []
3030
<strong>Explanation:</strong> The only possible triplet does not sum up to 0.
3131
</pre>
3232

33-
<p><strong>Example 3:</strong></p>
33+
<p><strong class="example">Example 3:</strong></p>
3434

3535
<pre>
3636
<strong>Input:</strong> nums = [0,0,0]

0 commit comments

Comments
 (0)