Skip to content

Commit 6ef4677

Browse files
committed
feat: generate English README for leetcode questions
生成 README_EN 文件
1 parent 2e2f1ca commit 6ef4677

File tree

1,389 files changed

+77334
-966
lines changed

Some content is hidden

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

1,389 files changed

+77334
-966
lines changed

solution/0001.Two Sum/README_EN.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# [1. Two Sum](https://leetcode.com/problems/two-sum)
2+
3+
## Description
4+
<p>Given an array of integers, return <strong>indices</strong> of the two numbers such that they add up to a specific target.</p>
5+
6+
<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>
7+
8+
<p><strong>Example:</strong></p>
9+
10+
<pre>
11+
Given nums = [2, 7, 11, 15], target = 9,
12+
13+
Because nums[<strong>0</strong>] + nums[<strong>1</strong>] = 2 + 7 = 9,
14+
return [<strong>0</strong>, <strong>1</strong>].
15+
</pre>
16+
17+
18+
19+
## Solution
20+
<!-- Type common method here -->
21+
22+
23+
### Python3
24+
<!-- Type special method here -->
25+
26+
```python
27+
28+
```
29+
30+
### Java
31+
<!-- Type special method here -->
32+
33+
```java
34+
35+
```
36+
37+
### ...
38+
```
39+
40+
```
41+

solution/0002.Add Two Numbers/README_EN.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# [2. Add Two Numbers](https://leetcode.com/problems/add-two-numbers)
2+
3+
## Description
4+
<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>
5+
6+
<p>You may assume the two numbers do not contain any leading zero, except the number 0 itself.</p>
7+
8+
<p><b>Example:</b></p>
9+
10+
<pre>
11+
<b>Input:</b> (2 -&gt; 4 -&gt; 3) + (5 -&gt; 6 -&gt; 4)
12+
<b>Output:</b> 7 -&gt; 0 -&gt; 8
13+
<b>Explanation:</b> 342 + 465 = 807.
14+
</pre>
15+
16+
17+
18+
## Solution
19+
<!-- Type common method here -->
20+
21+
22+
### Python3
23+
<!-- Type special method here -->
24+
25+
```python
26+
27+
```
28+
29+
### Java
30+
<!-- Type special method here -->
31+
32+
```java
33+
34+
```
35+
36+
### ...
37+
```
38+
39+
```
40+

solution/0003.Longest Substring Without Repeating Characters/README_EN.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# [3. Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters)
2+
3+
## Description
4+
<p>Given a string, find the length of the <b>longest substring</b> without repeating characters.</p>
5+
6+
<div>
7+
<p><strong>Example 1:</strong></p>
8+
9+
<pre>
10+
<strong>Input: </strong><span id="example-input-1-1">&quot;abcabcbb&quot;</span>
11+
<strong>Output: </strong><span id="example-output-1">3
12+
<strong>Explanation:</strong></span> The answer is <code>&quot;abc&quot;</code>, with the length of 3.
13+
</pre>
14+
15+
<div>
16+
<p><strong>Example 2:</strong></p>
17+
18+
<pre>
19+
<strong>Input: </strong><span id="example-input-2-1">&quot;bbbbb&quot;</span>
20+
<strong>Output: </strong><span id="example-output-2">1
21+
</span><span id="example-output-1"><strong>Explanation: </strong>T</span>he answer is <code>&quot;b&quot;</code>, with the length of 1.
22+
</pre>
23+
24+
<div>
25+
<p><strong>Example 3:</strong></p>
26+
27+
<pre>
28+
<strong>Input: </strong><span id="example-input-3-1">&quot;pwwkew&quot;</span>
29+
<strong>Output: </strong><span id="example-output-3">3
30+
</span><span id="example-output-1"><strong>Explanation: </strong></span>The answer is <code>&quot;wke&quot;</code>, with the length of 3.
31+
Note that the answer must be a <b>substring</b>, <code>&quot;pwke&quot;</code> is a <i>subsequence</i> and not a substring.
32+
</pre>
33+
</div>
34+
</div>
35+
</div>
36+
37+
38+
39+
## Solution
40+
<!-- Type common method here -->
41+
42+
43+
### Python3
44+
<!-- Type special method here -->
45+
46+
```python
47+
48+
```
49+
50+
### Java
51+
<!-- Type special method here -->
52+
53+
```java
54+
55+
```
56+
57+
### ...
58+
```
59+
60+
```
61+

solution/0004.Median of Two Sorted Arrays/README_EN.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# [4. Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays)
2+
3+
## Description
4+
<p>There are two sorted arrays <b>nums1</b> and <b>nums2</b> of size m and n respectively.</p>
5+
6+
<p>Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).</p>
7+
8+
<p>You may assume <strong>nums1</strong> and <strong>nums2</strong>&nbsp;cannot be both empty.</p>
9+
10+
<p><b>Example 1:</b></p>
11+
12+
<pre>
13+
nums1 = [1, 3]
14+
nums2 = [2]
15+
16+
The median is 2.0
17+
</pre>
18+
19+
<p><b>Example 2:</b></p>
20+
21+
<pre>
22+
nums1 = [1, 2]
23+
nums2 = [3, 4]
24+
25+
The median is (2 + 3)/2 = 2.5
26+
</pre>
27+
28+
29+
30+
## Solution
31+
<!-- Type common method here -->
32+
33+
34+
### Python3
35+
<!-- Type special method here -->
36+
37+
```python
38+
39+
```
40+
41+
### Java
42+
<!-- Type special method here -->
43+
44+
```java
45+
46+
```
47+
48+
### ...
49+
```
50+
51+
```
52+

solution/0005.Longest Palindromic Substring/README_EN.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# [5. Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring)
2+
3+
## Description
4+
<p>Given a string <strong>s</strong>, find the longest palindromic substring in <strong>s</strong>. You may assume that the maximum length of <strong>s</strong> is 1000.</p>
5+
6+
<p><strong>Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> &quot;babad&quot;
10+
<strong>Output:</strong> &quot;bab&quot;
11+
<strong>Note:</strong> &quot;aba&quot; is also a valid answer.
12+
</pre>
13+
14+
<p><strong>Example 2:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> &quot;cbbd&quot;
18+
<strong>Output:</strong> &quot;bb&quot;
19+
</pre>
20+
21+
22+
23+
## Solution
24+
<!-- Type common method here -->
25+
26+
27+
### Python3
28+
<!-- Type special method here -->
29+
30+
```python
31+
32+
```
33+
34+
### Java
35+
<!-- Type special method here -->
36+
37+
```java
38+
39+
```
40+
41+
### ...
42+
```
43+
44+
```
45+

solution/0006.ZigZag Conversion/README_EN.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# [6. ZigZag Conversion](https://leetcode.com/problems/zigzag-conversion)
2+
3+
## Description
4+
<p>The string <code>&quot;PAYPALISHIRING&quot;</code> is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)</p>
5+
6+
<pre>
7+
P A H N
8+
A P L S I I G
9+
Y I R
10+
</pre>
11+
12+
<p>And then read line by line: <code>&quot;PAHNAPLSIIGYIR&quot;</code></p>
13+
14+
<p>Write the code that will take a string and make this conversion given a number of rows:</p>
15+
16+
<pre>
17+
string convert(string s, int numRows);</pre>
18+
19+
<p><strong>Example 1:</strong></p>
20+
21+
<pre>
22+
<strong>Input:</strong> s = &quot;PAYPALISHIRING&quot;, numRows = 3
23+
<strong>Output:</strong> &quot;PAHNAPLSIIGYIR&quot;
24+
</pre>
25+
26+
<p><strong>Example 2:</strong></p>
27+
28+
<pre>
29+
<strong>Input:</strong> s = &quot;PAYPALISHIRING&quot;, numRows =&nbsp;4
30+
<strong>Output:</strong>&nbsp;&quot;PINALSIGYAHRPI&quot;
31+
<strong>Explanation:</strong>
32+
33+
P I N
34+
A L S I G
35+
Y A H R
36+
P I</pre>
37+
38+
39+
40+
## Solution
41+
<!-- Type common method here -->
42+
43+
44+
### Python3
45+
<!-- Type special method here -->
46+
47+
```python
48+
49+
```
50+
51+
### Java
52+
<!-- Type special method here -->
53+
54+
```java
55+
56+
```
57+
58+
### ...
59+
```
60+
61+
```
62+

solution/0007.Reverse Integer/README_EN.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# [7. Reverse Integer](https://leetcode.com/problems/reverse-integer)
2+
3+
## Description
4+
<p>Given a 32-bit signed integer, reverse digits of an integer.</p>
5+
6+
<p><strong>Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> 123
10+
<strong>Output:</strong> 321
11+
</pre>
12+
13+
<p><strong>Example 2:</strong></p>
14+
15+
<pre>
16+
<strong>Input:</strong> -123
17+
<strong>Output:</strong> -321
18+
</pre>
19+
20+
<p><strong>Example 3:</strong></p>
21+
22+
<pre>
23+
<strong>Input:</strong> 120
24+
<strong>Output:</strong> 21
25+
</pre>
26+
27+
<p><strong>Note:</strong><br />
28+
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [&minus;2<sup>31</sup>,&nbsp; 2<sup>31&nbsp;</sup>&minus; 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.</p>
29+
30+
31+
32+
## Solution
33+
<!-- Type common method here -->
34+
35+
36+
### Python3
37+
<!-- Type special method here -->
38+
39+
```python
40+
41+
```
42+
43+
### Java
44+
<!-- Type special method here -->
45+
46+
```java
47+
48+
```
49+
50+
### ...
51+
```
52+
53+
```
54+

0 commit comments

Comments
 (0)