Skip to content

Commit

Permalink
docs: add README_EN files
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme committed Mar 17, 2020
1 parent cb5a483 commit e1abef0
Show file tree
Hide file tree
Showing 1,391 changed files with 72,973 additions and 1,390 deletions.
Binary file added script/__pycache__/config.cpython-38.pyc
Binary file not shown.
Binary file added script/__pycache__/fetch.cpython-38.pyc
Binary file not shown.
28 changes: 25 additions & 3 deletions script/leetcode_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ def get_cn_questions() -> dict:
final_res[qid] = q['title']
return final_res

no_dict = {
'0': '0000-0099',
'1': '0100-0199',
'2': '0200-0299',
'3': '0300-0399',
'4': '0400-0499',
'5': '0500-0599',
'6': '0600-0699',
'7': '0700-0799',
'8': '0800-0899',
'9': '0900-0999',
'10': '1000-1099',
'11': '1100-1199',
'12': '1200-1299',
'13': '1300-1399',
'14': '1400-1499',
'15': '1500-1599',

}


def get_all_questions():
"""获取所有题目"""
Expand All @@ -39,10 +59,12 @@ def get_all_questions():
questions = res['stat_status_pairs']

for question in questions:
int_id = question['stat']['question_id']
qid = str(question['stat']['question_id']).zfill(4)
title = question['stat']['question__title']
link = problems_url + question['stat']['question__title_slug']
git_link = '/solution/{}/README.md'.format(qid + '.' + quote(title))
pre = no_dict[str(int(int_id) // 100)]
git_link = '/solution/{}/{}/README.md'.format(pre, qid + '.' + quote(title))
cn_title = cn_res.get(qid) or title
col1 = '[{}]({})'.format(qid, link)
col2 = '[{}]({})'.format(cn_title, git_link)
Expand Down Expand Up @@ -103,5 +125,5 @@ def generate_md_table_for_questions(res):

if __name__ == '__main__':
generate_md_table_for_questions(get_all_questions())
generate_md_table_for_questions(get_lcof_questions())
generate_md_table_for_questions(get_lcci_questions())
# generate_md_table_for_questions(get_lcof_questions())
# generate_md_table_for_questions(get_lcci_questions())
37 changes: 37 additions & 0 deletions solution/0000-0099/0001.Two Sum/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# [1. Two Sum](https://leetcode.com/problems/two-sum)

## Description
<p>Given an array of integers, return <strong>indices</strong> of the two numbers such that they add up to a specific target.</p>
<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>
<p><strong>Example:</strong></p>
<pre>
Given nums = [2, 7, 11, 15], target = 9,
Because nums[<strong>0</strong>] + nums[<strong>1</strong>] = 2 + 7 = 9,
return [<strong>0</strong>, <strong>1</strong>].
</pre>



## Solutions


### Python3

```python

```

### Java

```java

```

### ...
```

```
Expand Down
36 changes: 36 additions & 0 deletions solution/0000-0099/0002.Add Two Numbers/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# [2. Add Two Numbers](https://leetcode.com/problems/add-two-numbers)

## Description
<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>
<p>You may assume the two numbers do not contain any leading zero, except the number 0 itself.</p>
<p><b>Example:</b></p>
<pre>
<b>Input:</b> (2 -&gt; 4 -&gt; 3) + (5 -&gt; 6 -&gt; 4)
<b>Output:</b> 7 -&gt; 0 -&gt; 8
<b>Explanation:</b> 342 + 465 = 807.
</pre>



## Solutions


### Python3

```python

```

### Java

```java

```

### ...
```

```
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# [3. Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters)

## Description
<p>Given a string, find the length of the <b>longest substring</b> without repeating characters.</p>
<div>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input: </strong><span id="example-input-1-1">&quot;abcabcbb&quot;</span>
<strong>Output: </strong><span id="example-output-1">3
<strong>Explanation:</strong></span> The answer is <code>&quot;abc&quot;</code>, with the length of 3.
</pre>
<div>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input: </strong><span id="example-input-2-1">&quot;bbbbb&quot;</span>
<strong>Output: </strong><span id="example-output-2">1
</span><span id="example-output-1"><strong>Explanation: </strong>T</span>he answer is <code>&quot;b&quot;</code>, with the length of 1.
</pre>
<div>
<p><strong>Example 3:</strong></p>
<pre>
<strong>Input: </strong><span id="example-input-3-1">&quot;pwwkew&quot;</span>
<strong>Output: </strong><span id="example-output-3">3
</span><span id="example-output-1"><strong>Explanation: </strong></span>The answer is <code>&quot;wke&quot;</code>, with the length of 3.
Note that the answer must be a <b>substring</b>, <code>&quot;pwke&quot;</code> is a <i>subsequence</i> and not a substring.
</pre>
</div>
</div>
</div>



## Solutions


### Python3

```python

```

### Java

```java

```

### ...
```

```
Expand Down
48 changes: 48 additions & 0 deletions solution/0000-0099/0004.Median of Two Sorted Arrays/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# [4. Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays)

## Description
<p>There are two sorted arrays <b>nums1</b> and <b>nums2</b> of size m and n respectively.</p>
<p>Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).</p>
<p>You may assume <strong>nums1</strong> and <strong>nums2</strong>&nbsp;cannot be both empty.</p>
<p><b>Example 1:</b></p>
<pre>
nums1 = [1, 3]
nums2 = [2]
The median is 2.0
</pre>
<p><b>Example 2:</b></p>
<pre>
nums1 = [1, 2]
nums2 = [3, 4]
The median is (2 + 3)/2 = 2.5
</pre>



## Solutions


### Python3

```python

```

### Java

```java

```

### ...
```

```
Expand Down
41 changes: 41 additions & 0 deletions solution/0000-0099/0005.Longest Palindromic Substring/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# [5. Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring)

## Description
<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>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input:</strong> &quot;babad&quot;
<strong>Output:</strong> &quot;bab&quot;
<strong>Note:</strong> &quot;aba&quot; is also a valid answer.
</pre>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input:</strong> &quot;cbbd&quot;
<strong>Output:</strong> &quot;bb&quot;
</pre>



## Solutions


### Python3

```python

```

### Java

```java

```

### ...
```

```
Expand Down
58 changes: 58 additions & 0 deletions solution/0000-0099/0006.ZigZag Conversion/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# [6. ZigZag Conversion](https://leetcode.com/problems/zigzag-conversion)

## Description
<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>
<pre>
P A H N
A P L S I I G
Y I R
</pre>
<p>And then read line by line: <code>&quot;PAHNAPLSIIGYIR&quot;</code></p>
<p>Write the code that will take a string and make this conversion given a number of rows:</p>
<pre>
string convert(string s, int numRows);</pre>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = &quot;PAYPALISHIRING&quot;, numRows = 3
<strong>Output:</strong> &quot;PAHNAPLSIIGYIR&quot;
</pre>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input:</strong> s = &quot;PAYPALISHIRING&quot;, numRows =&nbsp;4
<strong>Output:</strong>&nbsp;&quot;PINALSIGYAHRPI&quot;
<strong>Explanation:</strong>
P I N
A L S I G
Y A H R
P I</pre>



## Solutions


### Python3

```python

```

### Java

```java

```

### ...
```

```
Expand Down
50 changes: 50 additions & 0 deletions solution/0000-0099/0007.Reverse Integer/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# [7. Reverse Integer](https://leetcode.com/problems/reverse-integer)

## Description
<p>Given a 32-bit signed integer, reverse digits of an integer.</p>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input:</strong> 123
<strong>Output:</strong> 321
</pre>
<p><strong>Example 2:</strong></p>
<pre>
<strong>Input:</strong> -123
<strong>Output:</strong> -321
</pre>
<p><strong>Example 3:</strong></p>
<pre>
<strong>Input:</strong> 120
<strong>Output:</strong> 21
</pre>
<p><strong>Note:</strong><br />
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>



## Solutions


### Python3

```python

```

### Java

```java

```

### ...
```

```
Expand Down
Loading

0 comments on commit e1abef0

Please sign in to comment.