Skip to content

Commit 318888c

Browse files
committed
feat: update lcci questions
更新《程序员面试金典》题目
1 parent ff61ae2 commit 318888c

File tree

74 files changed

+4047
-2954
lines changed

Some content is hidden

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

74 files changed

+4047
-2954
lines changed

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
- GitHub Pages: https://doocs.github.io/leetcode
2323
- Coding Pages: https://d3jc40.coding-pages.com
2424

25-
注:对于国内(中国)的朋友,推荐访问 [Coding Pages](https://d3jc40.coding-pages.com),页面加载速度最快。
26-
2725
## 题解
2826
- [LeetCode](/solution/README.md)
2927
- [LeetCode 《剑指 Offer(第 2 版)》](/lcof/README.md)
@@ -33,7 +31,7 @@
3331
[Yang Libin](https://github.com/yanglbme): GitHub 技术社区 [@Doocs](https://github.com/doocs) 创建者;[@TheAlgorithms](https://github.com/TheAlgorithms) 组织成员。
3432

3533
## 加入我们
36-
刷编程题的最大好处就是**可以锻炼解决问题的思维能力**。相信我,「如何去思考」​本身也是一项需要不断学习和练习的技能。非常感谢前微软工程师、现蚂蚁金服技术专家 [@kfstorm](https://github.com/kfstorm) 贡献了本项目的所有 [C# 题解](https://github.com/doocs/leetcode/pull/245)
34+
刷编程题的最大好处就是可以锻炼解决问题的思维能力。相信我,「如何去思考」​本身也是一项需要不断学习和练习的技能。非常感谢前微软工程师、现蚂蚁金服技术专家 [@kfstorm](https://github.com/kfstorm) 贡献了本项目的所有 [C# 题解](https://github.com/doocs/leetcode/pull/245)
3735

3836
如果你对本项目感兴趣,并且希望加入我们刷题大军,欢迎随时提交 [PR](https://github.com/doocs/leetcode/pulls)。请参考如下步骤:
3937

lcci/01.01.Is Unique/README_EN.md

-18
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
## Description
44
<p>Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?</p>
55

6-
7-
86
<p><strong>Example 1:</strong></p>
97

10-
11-
128
<pre>
139

1410
<strong>Input: </strong><code>s</code> = &quot;leetcode&quot;
@@ -17,12 +13,8 @@
1713

1814
</pre>
1915

20-
21-
2216
<p><strong>Example 2:</strong></p>
2317

24-
25-
2618
<pre>
2719

2820
<strong>Input: </strong><code>s</code> = &quot;abc&quot;
@@ -31,20 +23,10 @@
3123

3224
</pre>
3325

34-
35-
36-
<p>&nbsp;</p>
37-
38-
39-
4026
<p><strong>Note:</strong></p>
4127

42-
43-
4428
<ul>
45-
4629
<li><code>0 &lt;= len(s) &lt;= 100 </code></li>
47-
4830
</ul>
4931

5032

lcci/01.02.Check Permutation/README_EN.md

-6
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,9 @@
3434

3535

3636
<p><strong>Note:</strong></p>
37-
38-
39-
4037
<ol>
41-
4238
<li><code>0 &lt;= len(s1) &lt;= 100 </code></li>
43-
4439
<li><code>0 &lt;= len(s2) &lt;= 100</code></li>
45-
4640
</ol>
4741

4842

lcci/01.03.String to URL/README_EN.md

-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ The missing numbers are [5,6,8,...], hence the third missing number is 8.
4646

4747

4848
<ol>
49-
5049
<li><code>0 &lt;= S.length &lt;= 500000</code></li>
51-
5250
</ol>
5351

5452

lcci/01.04.Palindrome Permutation/README_EN.md

-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
</pre>
2323

24-
25-
26-
<p>&nbsp;</p>
27-
28-
29-
30-
3124
## Solutions
3225

3326

lcci/01.05.One Away/README_EN.md

-10
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,8 @@
33
## Description
44
<p>There are three types of edits that can be performed on strings: insert a character, remove a character, or replace a character. Given two strings, write a function to check if they are one edit (or zero edits) away.</p>
55

6-
7-
8-
<p>&nbsp;</p>
9-
10-
11-
126
<p><strong>Example&nbsp;1:</strong></p>
137

14-
15-
168
<pre>
179

1810
<strong>Input:</strong>
@@ -25,8 +17,6 @@ second = &quot;ple&quot;
2517

2618
</pre>
2719

28-
29-
3020
<p><strong>Example&nbsp;2:</strong></p>
3121

3222

lcci/01.06.Compress String/README_EN.md

-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
<p><strong>Example 1:</strong></p>
99

10-
11-
1210
<pre>
1311

1412
<strong>Input: </strong>&quot;aabcccccaaa&quot;
@@ -35,8 +33,6 @@ The compressed string is &quot;a1b2c2d1&quot;, which is longer than the original
3533

3634
</pre>
3735

38-
<p>&nbsp;</p>
39-
4036
<p><strong>Note:</strong></p>
4137

4238
- `0 <= S.length <= 50000`

lcci/01.09.String Rotation/README_EN.md

-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242

4343

4444
<ol>
45-
4645
<li><code><font face="monospace">0 &lt;= s1.length, s1.length &lt;=&nbsp;</font>100000</code></li>
47-
4846
</ol>
4947

5048

lcci/02.01.Remove Duplicate Node/README_EN.md

-12
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
## Description
44
<p>Write code to remove duplicates from an unsorted linked list.</p>
55

6-
7-
86
<p><strong>Example1:</strong></p>
97

108

11-
129
<pre>
1310

1411
<strong> Input</strong>: [1, 2, 3, 3, 2, 1]
@@ -18,11 +15,8 @@
1815
</pre>
1916

2017

21-
2218
<p><strong>Example2:</strong></p>
2319

24-
25-
2620
<pre>
2721

2822
<strong> Input</strong>: [1, 1, 1, 1, 2]
@@ -31,18 +25,12 @@
3125

3226
</pre>
3327

34-
35-
3628
<p><strong>Note: </strong></p>
3729

38-
39-
4030
<ol>
41-
4231
<li>The length of the list is within the range[0, 20000].</li>
4332

4433
<li>The values of the list elements are within the range [0, 20000].</li>
45-
4634
</ol>
4735

4836

lcci/02.02.Kth Node From End of List/README_EN.md

-4
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@
2323

2424
<p><strong>Note: </strong></p>
2525

26-
27-
2826
<p>k is always valid.</p>
2927

3028

31-
32-
3329
## Solutions
3430

3531

lcci/03.04.Implement Queue using Stacks/README_EN.md

-4
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ queue.empty(); // return false</pre>
3838

3939

4040
<ul>
41-
4241
<li>You must use&nbsp;<i>only</i>&nbsp;standard operations of a stack -- which means only&nbsp;<code>push to top</code>,&nbsp;<code>peek/pop from top</code>,&nbsp;<code>size</code>, and&nbsp;<code>is empty</code>&nbsp;operations are valid.</li>
43-
4442
<li>Depending on your language, stack may not be supported natively. You may simulate a stack by using a list or deque (double-ended queue), as long as you use only standard operations of a stack.</li>
45-
4643
<li>You may assume that all operations are valid (for example, no pop or peek operations will be called on an empty queue).</li>
47-
4844
</ul>
4945

5046

lcci/03.05.Sort of Stacks/README_EN.md

-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@
5050

5151

5252
<ol>
53-
5453
<li>The total number of elements in the stack is within the range [0, 5000].</li>
55-
5654
</ol>
5755

5856

lcci/03.06.Animal Shelter/README_EN.md

-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@
5858

5959

6060
<ol>
61-
6261
<li>The number of animals in the shelter will not exceed 20000.</li>
63-
6462
</ol>
6563

6664

+67-48
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,67 @@
1-
# [04.01. Route Between Nodes](https://leetcode-cn.com/problems/route-between-nodes-lcci)
2-
3-
## Description
4-
<p>Given a directed graph, design an algorithm to find out whether there is a route between two nodes.</p>
5-
6-
<p><strong>Example1:</strong></p>
7-
8-
<pre>
9-
<strong> Input</strong>: n = 3, graph = [[0, 1], [0, 2], [1, 2], [1, 2]], start = 0, target = 2
10-
<strong> Output</strong>: true
11-
</pre>
12-
13-
<p><strong>Example2:</strong></p>
14-
15-
<pre>
16-
<strong> Input</strong>: n = 5, graph = [[0, 1], [0, 2], [0, 4], [0, 4], [0, 1], [1, 3], [1, 4], [1, 3], [2, 3], [3, 4]], start = 0, target = 4
17-
<strong> Output</strong> true
18-
</pre>
19-
20-
<p><strong>Note: </strong></p>
21-
22-
<ol>
23-
<li><code>0 &lt;= n &lt;= 100000</code></li>
24-
<li>All node numbers are within the range [0, n].</li>
25-
<li>There might be self cycles and duplicated edges.</li>
26-
</ol>
27-
28-
29-
30-
## Solutions
31-
32-
33-
### Python3
34-
35-
```python
36-
37-
```
38-
39-
### Java
40-
41-
```java
42-
43-
```
44-
45-
### ...
46-
```
47-
48-
```
1+
# [04.01. Route Between Nodes](https://leetcode-cn.com/problems/route-between-nodes-lcci)
2+
3+
## Description
4+
<p>Given a directed graph, design an algorithm to find out whether there is a route between two nodes.</p>
5+
6+
7+
8+
<p><strong>Example1:</strong></p>
9+
10+
11+
12+
<pre>
13+
14+
<strong> Input</strong>: n = 3, graph = [[0, 1], [0, 2], [1, 2], [1, 2]], start = 0, target = 2
15+
16+
<strong> Output</strong>: true
17+
18+
</pre>
19+
20+
21+
22+
<p><strong>Example2:</strong></p>
23+
24+
25+
26+
<pre>
27+
28+
<strong> Input</strong>: n = 5, graph = [[0, 1], [0, 2], [0, 4], [0, 4], [0, 1], [1, 3], [1, 4], [1, 3], [2, 3], [3, 4]], start = 0, target = 4
29+
30+
<strong> Output</strong> true
31+
32+
</pre>
33+
34+
35+
36+
<p><strong>Note: </strong></p>
37+
38+
39+
40+
<ol>
41+
<li><code>0 &lt;= n &lt;= 100000</code></li>
42+
<li>All node numbers are within the range [0, n].</li>
43+
<li>There might be self cycles and duplicated edges.</li>
44+
</ol>
45+
46+
47+
48+
49+
## Solutions
50+
51+
52+
### Python3
53+
54+
```python
55+
56+
```
57+
58+
### Java
59+
60+
```java
61+
62+
```
63+
64+
### ...
65+
```
66+
67+
```

lcci/04.08.First Common Ancestor/README_EN.md

-5
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,9 @@
5959

6060
<p><strong>Notes:</strong></p>
6161

62-
63-
6462
<ul>
65-
6663
<li>All node values are pairwise distinct.</li>
67-
6864
<li>p, q are different node and both can be found in the given tree.</li>
69-
7065
</ul>
7166

7267

0 commit comments

Comments
 (0)