Skip to content

Commit 165dac5

Browse files
更新头部信息,添加其他语言
1 parent 71bb92b commit 165dac5

File tree

165 files changed

+2814
-468
lines changed

Some content is hidden

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

165 files changed

+2814
-468
lines changed

problems/0001.两数之和.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910
## 1. 两数之和
@@ -80,8 +81,22 @@ public:
8081
8182
8283
84+
## 其他语言版本
85+
86+
87+
Java:
88+
89+
90+
Python:
91+
92+
93+
Go:
94+
95+
96+
97+
8398
-----------------------
84-
* 微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
85-
* B站:[代码随想录](https://space.bilibili.com/525438321)
99+
* 作者微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
100+
* B站视频:[代码随想录](https://space.bilibili.com/525438321)
86101
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
87102
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0015.三数之和.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910

@@ -173,8 +174,22 @@ public:
173174

174175

175176

177+
## 其他语言版本
178+
179+
180+
Java:
181+
182+
183+
Python:
184+
185+
186+
Go:
187+
188+
189+
190+
176191
-----------------------
177-
* 微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
178-
* B站[代码随想录](https://space.bilibili.com/525438321)
192+
* 作者微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
193+
* B站视频[代码随想录](https://space.bilibili.com/525438321)
179194
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
180195
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0017.电话号码的字母组合.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910
# 17.电话号码的字母组合
@@ -235,8 +236,22 @@ public:
235236

236237

237238

239+
## 其他语言版本
240+
241+
242+
Java:
243+
244+
245+
Python:
246+
247+
248+
Go:
249+
250+
251+
252+
238253
-----------------------
239-
* 微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
240-
* B站[代码随想录](https://space.bilibili.com/525438321)
254+
* 作者微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
255+
* B站视频[代码随想录](https://space.bilibili.com/525438321)
241256
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
242257
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0018.四数之和.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910
> 一样的道理,能解决四数之和
@@ -116,8 +117,22 @@ public:
116117

117118

118119

120+
## 其他语言版本
121+
122+
123+
Java:
124+
125+
126+
Python:
127+
128+
129+
Go:
130+
131+
132+
133+
119134
-----------------------
120-
* 微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
121-
* B站[代码随想录](https://space.bilibili.com/525438321)
135+
* 作者微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
136+
* B站视频[代码随想录](https://space.bilibili.com/525438321)
122137
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
123138
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0019.删除链表的倒数第N个节点.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910

@@ -113,10 +114,8 @@ class Solution {
113114
```
114115

115116

116-
117-
118117
-----------------------
119-
* 微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
120-
* B站[代码随想录](https://space.bilibili.com/525438321)
118+
* 作者微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
119+
* B站视频[代码随想录](https://space.bilibili.com/525438321)
121120
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
122121
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0020.有效的括号.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910

@@ -133,8 +134,22 @@ public:
133134
134135
135136
137+
## 其他语言版本
138+
139+
140+
Java:
141+
142+
143+
Python:
144+
145+
146+
Go:
147+
148+
149+
150+
136151
-----------------------
137-
* 微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
138-
* B站:[代码随想录](https://space.bilibili.com/525438321)
152+
* 作者微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
153+
* B站视频:[代码随想录](https://space.bilibili.com/525438321)
139154
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
140155
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0027.移除元素.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910
## 27. 移除元素
@@ -118,8 +119,22 @@ public:
118119
119120
120121
122+
## 其他语言版本
123+
124+
125+
Java:
126+
127+
128+
Python:
129+
130+
131+
Go:
132+
133+
134+
135+
121136
-----------------------
122-
* 微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
123-
* B站:[代码随想录](https://space.bilibili.com/525438321)
137+
* 作者微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
138+
* B站视频:[代码随想录](https://space.bilibili.com/525438321)
124139
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
125140
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0028.实现strStr.md

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910
> 在一个串中查找是否出现过另一个串,这是KMP的看家本领。
@@ -559,9 +560,54 @@ public:
559560
可以说把KMP的每一个细微的细节都扣了出来,毫无遮掩的展示给大家了!
560561

561562

563+
## 其他语言版本
562564

563565

564-
## 其他语言版本实现
566+
Java:
567+
568+
```java
569+
// 方法一
570+
class Solution {
571+
public void getNext(int[] next, String s){
572+
int j = -1;
573+
next[0] = j;
574+
for (int i = 1; i<s.length(); i++){
575+
while(j>=0 && s.charAt(i) != s.charAt(j+1)){
576+
j=next[j];
577+
}
578+
579+
if(s.charAt(i)==s.charAt(j+1)){
580+
j++;
581+
}
582+
next[i] = j;
583+
}
584+
}
585+
public int strStr(String haystack, String needle) {
586+
if(needle.length()==0){
587+
return 0;
588+
}
589+
590+
int[] next = new int[needle.length()];
591+
getNext(next, needle);
592+
int j = -1;
593+
for(int i = 0; i<haystack.length();i++){
594+
while(j>=0 && haystack.charAt(i) != needle.charAt(j+1)){
595+
j = next[j];
596+
}
597+
if(haystack.charAt(i)==needle.charAt(j+1)){
598+
j++;
599+
}
600+
if(j==needle.length()-1){
601+
return (i-needle.length()+1);
602+
}
603+
}
604+
605+
return -1;
606+
}
607+
}
608+
```
609+
610+
Python:
565611

566612
```python
567613
// 方法一
@@ -630,53 +676,12 @@ class Solution:
630676
return next
631677
```
632678

633-
```java
634-
// 方法一
635-
class Solution {
636-
public void getNext(int[] next, String s){
637-
int j = -1;
638-
next[0] = j;
639-
for (int i = 1; i<s.length(); i++){
640-
while(j>=0 && s.charAt(i) != s.charAt(j+1)){
641-
j=next[j];
642-
}
643-
644-
if(s.charAt(i)==s.charAt(j+1)){
645-
j++;
646-
}
647-
next[i] = j;
648-
}
649-
}
650-
public int strStr(String haystack, String needle) {
651-
if(needle.length()==0){
652-
return 0;
653-
}
654-
655-
int[] next = new int[needle.length()];
656-
getNext(next, needle);
657-
int j = -1;
658-
for(int i = 0; i<haystack.length();i++){
659-
while(j>=0 && haystack.charAt(i) != needle.charAt(j+1)){
660-
j = next[j];
661-
}
662-
if(haystack.charAt(i)==needle.charAt(j+1)){
663-
j++;
664-
}
665-
if(j==needle.length()-1){
666-
return (i-needle.length()+1);
667-
}
668-
}
669-
670-
return -1;
671-
}
672-
}
673-
```
674-
679+
Go:
675680

676681

677682

678683
-----------------------
679-
* 微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
680-
* B站[代码随想录](https://space.bilibili.com/525438321)
684+
* 作者微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
685+
* B站视频[代码随想录](https://space.bilibili.com/525438321)
681686
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
682687
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

problems/0035.搜索插入位置.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<a href="https://img-blog.csdnimg.cn/20201210231711160.png"><img src="https://img.shields.io/badge/公众号-代码随想录-brightgreen" alt=""></a>
55
<a href="https://space.bilibili.com/525438321"><img src="https://img.shields.io/badge/B站-代码随想录-orange" alt=""></a>
66
</p>
7+
<p align="center"><strong>欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
78

89

910

@@ -202,8 +203,22 @@ public:
202203

203204

204205

206+
## 其他语言版本
207+
208+
209+
Java:
210+
211+
212+
Python:
213+
214+
215+
Go:
216+
217+
218+
219+
205220
-----------------------
206-
* 微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
207-
* B站[代码随想录](https://space.bilibili.com/525438321)
221+
* 作者微信[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
222+
* B站视频[代码随想录](https://space.bilibili.com/525438321)
208223
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
209224
<div align="center"><img src=../pics/公众号.png width=450 alt=> </img></div>

0 commit comments

Comments
 (0)