Skip to content

Commit 066e76b

Browse files
committed
feat: generate readme files for lcci questions
生成《程序员面试金典》题目文档
1 parent 8ec3e05 commit 066e76b

File tree

253 files changed

+10688
-953
lines changed

Some content is hidden

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

253 files changed

+10688
-953
lines changed

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@
88
<a href="https://github.com/doocs/leetcode/issues"><img src="https://badgen.net/github/open-issues/doocs/leetcode" alt="issues"></a>
99
<a href="https://github.com/doocs/leetcode/network/members"><img src="https://img.shields.io/github/forks/doocs/leetcode.svg" alt="forks"></a>
1010
<a href="https://github.com/doocs/leetcode/blob/master/LICENSE"><img src="https://badgen.net/github/license/doocs/leetcode?color=green" alt="LICENSE"></a><br>
11-
<a href="https://github.com/doocs/leetcode" alt="github"><img src="https://badgen.net/badge/⭐/GitHub/cyan" /></a>
12-
<a href="https://gitee.com/doocs/leetcode" alt="gitee"><img src="https://badgen.net/badge/⭐/Gitee/cyan" /></a>
11+
<!-- <a href="https://github.com/doocs/leetcode" alt="github"><img src="https://badgen.net/badge/⭐/GitHub/cyan" /></a>
12+
<a href="https://gitee.com/doocs/leetcode" alt="gitee"><img src="https://badgen.net/badge/⭐/Gitee/cyan" /></a> -->
1313
<a href="http://makeapullrequest.com"><img src="https://badgen.net/badge/PRs/welcome/cyan" alt="PRs Welcome"></a>
1414
<a href="https://doocs.github.io/#/?id=how-to-join"><img src="https://badgen.net/badge/organization/join%20us/cyan" alt="open-source-organization"></a>
1515
</p>
1616

1717
## 介绍
1818
本项目包含 [LeetCode](https://leetcode-cn.com/problemset/all/)[《剑指 Offer(第 2 版)》](https://leetcode-cn.com/problemset/lcof/)[《程序员面试金典(第 6 版)》](https://leetcode-cn.com/problemset/lcci/)等题目的相关题解。所有题解均由多种编程语言实现,包括但不限于:Java、Python、C++、JavaScript、C#、Go,日常更新。
1919

20-
[English Version](./README_EN.md)
20+
[English Version](/README_EN.md)
2121

2222
## 站点
23-
- Gitee Pages: https://doocs.gitee.io/leetcode
24-
- GitHub Pages: https://doocs.github.io/leetcode
23+
<!-- - Gitee Pages: https://doocs.gitee.io/leetcode
24+
- GitHub Pages: https://doocs.github.io/leetcode -->
2525

26-
注:对于国内(中国)的朋友,访问 Gitee Pages 速度会相对快一些。
26+
<!-- 注:对于国内(中国)的朋友,访问 Gitee Pages 速度会相对快一些。 -->
27+
https://doocs.github.io/leetcode/#/README_EN
2728

2829
## 题解
2930
- [LeetCode](./solution/README.md)

README_EN.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@
88
<a href="https://github.com/doocs/leetcode/issues"><img src="https://badgen.net/github/open-issues/doocs/leetcode" alt="issues"></a>
99
<a href="https://github.com/doocs/leetcode/network/members"><img src="https://img.shields.io/github/forks/doocs/leetcode.svg" alt="forks"></a>
1010
<a href="https://github.com/doocs/leetcode/blob/master/LICENSE"><img src="https://badgen.net/github/license/doocs/leetcode?color=green" alt="LICENSE"></a><br>
11-
<a href="https://github.com/doocs/leetcode" alt="github"><img src="https://badgen.net/badge/⭐/GitHub/cyan" /></a>
12-
<a href="https://gitee.com/doocs/leetcode" alt="gitee"><img src="https://badgen.net/badge/⭐/Gitee/cyan" /></a>
11+
<!-- <a href="https://github.com/doocs/leetcode" alt="github"><img src="https://badgen.net/badge/⭐/GitHub/cyan" /></a>
12+
<a href="https://gitee.com/doocs/leetcode" alt="gitee"><img src="https://badgen.net/badge/⭐/Gitee/cyan" /></a> -->
1313
<a href="http://makeapullrequest.com"><img src="https://badgen.net/badge/PRs/welcome/cyan" alt="PRs Welcome"></a>
1414
<a href="https://doocs.github.io/#/?id=how-to-join"><img src="https://badgen.net/badge/organization/join%20us/cyan" alt="open-source-organization"></a>
1515
</p>
1616

1717
## Introduction
1818
Complete solutions to [LeetCode](https://leetcode-cn.com/problemset/all/), [LCOF](https://leetcode-cn.com/problemset/lcof/) and [LCCI](https://leetcode-cn.com/problemset/lcci/) problems, updated daily.
1919

20-
[中文文档](./README.md)
20+
[中文文档](/README.md)
2121

2222
## Sites
23-
- Gitee Pages: https://doocs.gitee.io/leetcode
24-
- GitHub Pages: https://doocs.github.io/leetcode
23+
<!-- - Gitee Pages: https://doocs.gitee.io/leetcode
24+
- GitHub Pages: https://doocs.github.io/leetcode -->
25+
https://doocs.gitee.io/leetcode
2526

2627
## Solutions
2728
- [LeetCode](./solution/README.md)

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
} else {
6262
url = 'https://github.com/doocs/leetcode/blob/master/' + vm.route.file
6363
}
64-
var editHtml = '[:memo: 在 GitHub 编辑](' + url + ')\n'
64+
var editHtml = '[:memo: Edit on GitHub](' + url + ')\n'
6565
return editHtml + html
6666
})
6767
},

lcci/01.01.Is Unique/README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# [面试题 01.01. 判定字符是否唯一](https://leetcode-cn.com/problems/is-unique-lcci)
2+
3+
## 题目描述
4+
<!-- 这里写题目描述 -->
5+
<p>实现一个算法,确定一个字符串 <code>s</code> 的所有字符是否全都不同。</p>
6+
7+
<p><strong>示例 1:</strong></p>
8+
9+
<pre><strong>输入:</strong> <code>s</code> = &quot;leetcode&quot;
10+
<strong>输出:</strong> false
11+
</pre>
12+
13+
<p><strong>示例 2:</strong></p>
14+
15+
<pre><strong>输入:</strong> <code>s</code> = &quot;abc&quot;
16+
<strong>输出:</strong> true
17+
</pre>
18+
19+
<p><strong>限制:</strong></p>
20+
<ul>
21+
<li><code>0 <= len(s) <= 100 </code></li>
22+
<li>如果你不使用额外的数据结构,会很加分。</li>
23+
</ul>
24+
25+
26+
## 解法
27+
<!-- 这里可写通用的实现逻辑 -->
28+
29+
30+
### Python3
31+
<!-- 这里可写当前语言的特殊实现逻辑 -->
32+
33+
```python
34+
class Solution:
35+
def isUnique(self, astr: str) -> bool:
36+
sets = set(astr)
37+
return len(sets) == len(astr)
38+
```
39+
40+
### Java
41+
<!-- 这里可写当前语言的特殊实现逻辑 -->
42+
43+
```java
44+
class Solution {
45+
public boolean isUnique(String astr) {
46+
char[] chars = astr.toCharArray();
47+
int len = chars.length;
48+
for (int i = 0; i < len - 1; ++i) {
49+
for (int j = i + 1; j < len; ++j) {
50+
if (chars[i] == chars[j]) {
51+
return false;
52+
}
53+
}
54+
}
55+
return true;
56+
}
57+
}
58+
```
59+
60+
### ...
61+
```
62+
63+
```

lcci/01.01.Is Unique/README_EN.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# [01.01. Is Unique](https://leetcode-cn.com/problems/is-unique-lcci)
2+
3+
## Description
4+
<p>Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?</p>
5+
6+
7+
8+
<p><strong>Example 1:</strong></p>
9+
10+
11+
12+
<pre>
13+
14+
<strong>Input: </strong><code>s</code> = &quot;leetcode&quot;
15+
16+
<strong>Output: </strong>false
17+
18+
</pre>
19+
20+
21+
22+
<p><strong>Example 2:</strong></p>
23+
24+
25+
26+
<pre>
27+
28+
<strong>Input: </strong><code>s</code> = &quot;abc&quot;
29+
30+
<strong>Output: </strong>true
31+
32+
</pre>
33+
34+
35+
36+
<p>&nbsp;</p>
37+
38+
39+
40+
<p><strong>Note:</strong></p>
41+
42+
43+
44+
<ul>
45+
46+
<li><code>0 &lt;= len(s) &lt;= 100 </code></li>
47+
48+
</ul>
49+
50+
51+
52+
53+
## Solutions
54+
55+
56+
### Python3
57+
58+
```python
59+
class Solution:
60+
def isUnique(self, astr: str) -> bool:
61+
sets = set(astr)
62+
return len(sets) == len(astr)
63+
```
64+
65+
### Java
66+
67+
```java
68+
class Solution {
69+
public boolean isUnique(String astr) {
70+
char[] chars = astr.toCharArray();
71+
int len = chars.length;
72+
for (int i = 0; i < len - 1; ++i) {
73+
for (int j = i + 1; j < len; ++j) {
74+
if (chars[i] == chars[j]) {
75+
return false;
76+
}
77+
}
78+
}
79+
return true;
80+
}
81+
}
82+
```
83+
84+
### ...
85+
```
86+
87+
```
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# [面试题 01.02. 判定是否互为字符重排](https://leetcode-cn.com/problems/check-permutation-lcci)
2+
3+
## 题目描述
4+
<!-- 这里写题目描述 -->
5+
<p>给定两个字符串 <code>s1</code> 和 <code>s2</code>,请编写一个程序,确定其中一个字符串的字符重新排列后,能否变成另一个字符串。</p>
6+
7+
<p><strong>示例 1:</strong></p>
8+
9+
<pre><strong>输入:</strong> <code>s1</code> = &quot;abc&quot;, <code>s2</code> = &quot;bca&quot;
10+
<strong>输出:</strong> true
11+
</pre>
12+
13+
<p><strong>示例 2:</strong></p>
14+
15+
<pre><strong>输入:</strong> <code>s1</code> = &quot;abc&quot;, <code>s2</code> = &quot;bad&quot;
16+
<strong>输出:</strong> false
17+
</pre>
18+
19+
<p><strong>说明:</strong></p>
20+
21+
<ul>
22+
<li><code>0 &lt;= len(s1) &lt;= 100 </code></li>
23+
<li><code>0 &lt;= len(s2) &lt;= 100 </code></li>
24+
</ul>
25+
26+
27+
## 解法
28+
<!-- 这里可写通用的实现逻辑 -->
29+
30+
31+
### Python3
32+
<!-- 这里可写当前语言的特殊实现逻辑 -->
33+
34+
```python
35+
class Solution:
36+
def CheckPermutation(self, s1: str, s2: str) -> bool:
37+
return sorted(s1) == sorted(s2)
38+
```
39+
40+
### Java
41+
<!-- 这里可写当前语言的特殊实现逻辑 -->
42+
43+
```java
44+
45+
```
46+
47+
### ...
48+
```
49+
50+
```
+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# [01.02. Check Permutation](https://leetcode-cn.com/problems/check-permutation-lcci)
2+
3+
## Description
4+
<p>Given two strings,write a method to decide if one is a permutation of the other.</p>
5+
6+
7+
8+
<p><strong>Example 1:</strong></p>
9+
10+
11+
12+
<pre>
13+
14+
<strong>Input: </strong><code>s1</code> = &quot;abc&quot;, <code>s2</code> = &quot;bca&quot;
15+
16+
<strong>Output: </strong>true
17+
18+
</pre>
19+
20+
21+
22+
<p><strong>Example 2:</strong></p>
23+
24+
25+
26+
<pre>
27+
28+
<strong>Input: </strong><code>s1</code> = &quot;abc&quot;, <code>s2</code> = &quot;bad&quot;
29+
30+
<strong>Output: </strong>false
31+
32+
</pre>
33+
34+
35+
36+
<p><strong>Note:</strong></p>
37+
38+
39+
40+
<ol>
41+
42+
<li><code>0 &lt;= len(s1) &lt;= 100 </code></li>
43+
44+
<li><code>0 &lt;= len(s2) &lt;= 100</code></li>
45+
46+
</ol>
47+
48+
49+
50+
51+
## Solutions
52+
53+
54+
### Python3
55+
56+
```python
57+
class Solution:
58+
def CheckPermutation(self, s1: str, s2: str) -> bool:
59+
return sorted(s1) == sorted(s2)
60+
```
61+
62+
### Java
63+
64+
```java
65+
66+
```
67+
68+
### ...
69+
```
70+
71+
```

lcci/01.03.String to URL/README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# [面试题 01.03. URL化](https://leetcode-cn.com/problems/string-to-url-lcci)
2+
3+
## 题目描述
4+
<!-- 这里写题目描述 -->
5+
<p>URL化。编写一种方法,将字符串中的空格全部替换为<code>%20</code>。假定该字符串尾部有足够的空间存放新增字符,并且知道字符串的&ldquo;真实&rdquo;长度。(注:用<code>Java</code>实现的话,请使用字符数组实现,以便直接在数组上操作。)</p>
6+
7+
<p><strong>示例1:</strong></p>
8+
9+
<pre><strong> 输入</strong>:&quot;Mr John Smith &quot;, 13
10+
<strong> 输出</strong>:&quot;Mr%20John%20Smith&quot;
11+
</pre>
12+
13+
<p><strong>示例2:</strong></p>
14+
15+
<pre><strong> 输入</strong>:&quot; &quot;, 5
16+
<strong> 输出</strong>:&quot;%20%20%20%20%20&quot;
17+
</pre>
18+
19+
<p><strong>提示:</strong></p>
20+
21+
<ol>
22+
<li>字符串长度在[0, 500000]范围内。</li>
23+
</ol>
24+
25+
26+
## 解法
27+
<!-- 这里可写通用的实现逻辑 -->
28+
29+
30+
### Python3
31+
<!-- 这里可写当前语言的特殊实现逻辑 -->
32+
33+
```python
34+
class Solution:
35+
def replaceSpaces(self, S: str, length: int) -> str:
36+
S = S[:length] if length < len(S) else S
37+
return S.replace(' ', '%20')
38+
```
39+
40+
### Java
41+
<!-- 这里可写当前语言的特殊实现逻辑 -->
42+
43+
```java
44+
45+
```
46+
47+
### ...
48+
```
49+
50+
```

0 commit comments

Comments
 (0)