Skip to content

Commit d7906c3

Browse files
committed
Merge branch 'master' of https://github.com/Gapur/leetcode
2 parents 42e4dbb + c9038d0 commit d7906c3

File tree

4,549 files changed

+176633
-17233
lines changed

Some content is hidden

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

4,549 files changed

+176633
-17233
lines changed

.github/CODEOWNERS

-6
This file was deleted.

.github/workflows/sync.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Sync
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Sync to Gitee
12+
uses: wearerequired/git-mirror-action@master
13+
env:
14+
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
15+
with:
16+
source-repo: "git@github.com:doocs/leetcode.git"
17+
destination-repo: "git@gitee.com:Doocs/leetcode.git"

.gitignore

-32
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
1-
/gradle/wrapper/gradle-wrapper.properties
2-
##----------Android----------
3-
# build
4-
*.apk
5-
*.ap_
6-
*.dex
7-
*.class
8-
bin/
9-
gen/
10-
build/
11-
12-
# gradle
13-
.gradle/
14-
gradle-app.setting
15-
!gradle-wrapper.jar
16-
build/
17-
18-
local.properties
19-
20-
##----------idea----------
21-
*.iml
221
.idea/
23-
*.ipr
24-
*.iws
25-
26-
# Android Studio Navigation editor temp files
27-
.navigation/
28-
29-
##----------Other----------
30-
# osx
31-
*~
322
.DS_Store
33-
gradle.properties
34-
353
.vscode

README.md

+32-18
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,49 @@
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>
1111
<a href="http://makeapullrequest.com"><img src="https://badgen.net/badge/PRs/welcome/cyan" alt="PRs Welcome"></a>
1212
<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>
13-
<!-- <a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/doocs-leetcode/backers/badge.svg" /></a>
14-
<a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/doocs-leetcode/sponsors/badge.svg" /></a> -->
1513
</p>
1614

17-
## Introduction
18-
Complete [solutions](/solution) to [LeetCode problems](https://leetcode-cn.com/problemset/all/), updated daily.
15+
## 介绍
16+
本项目包含 [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,日常更新。欢迎 [Star](https://github.com/doocs/leetcode) 关注本项目,获取项目最新动态。
1917

20-
## Solution Tree
21-
See [SOLUTION_TREE](/solution/README.md).
18+
[English Version](/README_EN.md)
2219

23-
## Contributions
24-
I'm looking for long-term contributors/partners to this repo! Send me [PRs](https://github.com/doocs/leetcode/pulls) if you're interested! See the following:
25-
- <kbd>Fork</kbd> [this repository](https://github.com/doocs/leetcode) to your own GitHub account and then <kbd>clone</kbd> it to your local machine.
26-
- Make some changes to your leetcode repository, then <kbd>add</kbd>, <kbd>commit</kbd> and <kbd>push</kbd> the changes to your remote GitHub repository.
27-
- Submit a pull request with your changes!
28-
- See [CONTRIBUTING](https://github.com/doocs/.github/blob/master/CONTRIBUTING.md) or [GitHub Help](https://help.github.com/en) for more details.
20+
## 站点
21+
- GitHub Pages: https://doocs.github.io/leetcode
22+
- Coding Pages: https://d3jc40.coding-pages.com
23+
24+
注:若 [GitHub Pages](https://doocs.github.io/leetcode) 访问加载过慢,可访问 [Coding Pages](https://d3jc40.coding-pages.com)
25+
26+
## 题解
27+
- [LeetCode](/solution/README.md)
28+
- [剑指 Offer(第 2 版)](/lcof/README.md)
29+
- [程序员面试金典(第 6 版)](/lcci/README.md)
30+
31+
## 维护者
32+
[Yang Libin](https://github.com/yanglbme): GitHub 技术社区 [@Doocs](https://github.com/doocs) 创建者;[@TheAlgorithms](https://github.com/TheAlgorithms) 组织成员。
33+
34+
## 加入我们
35+
刷编程题的最大好处就是**可以锻炼解决问题的思维能力**。相信我,「如何去思考」​本身也是一项需要不断学习和练习的技能。非常感谢前微软工程师、现蚂蚁金服技术专家 [@kfstorm](https://github.com/kfstorm) 贡献了本项目的所有 [C# 题解](https://github.com/doocs/leetcode/pull/245)
36+
37+
如果你对本项目感兴趣,并且希望加入我们刷题大军,欢迎随时提交 [PR](https://github.com/doocs/leetcode/pulls)。请参考如下步骤:
38+
39+
-[本项目](https://github.com/doocs/leetcode) <kbd>Fork</kbd> 到你的个人 GitHub 帐户,然后 <kbd>clone</kbd> 到你的本地机器;
40+
- 对项目做出一些变更,然后使用 git <kbd>add</kbd>、<kbd>commit</kbd>、<kbd>push</kbd> 等命令将你的变更提交到你的远程 GitHub 仓库;
41+
- 将你的变更以 PR 的形式提交过来,项目的维护人员会在第一时间对你的变更进行 review!
42+
- 你也可以参考 [GitHub 帮助文档](https://help.github.com/cn) 了解更多细节。
2943

3044
<p align="center">
3145
<a href="https://github.com/doocs/leetcode"><img src="./img/how-to-contribute.png" alt="how-to-contribute"></a>
3246
</p>
3347

34-
You can also contribute to [doocs/leetcode](https://github.com/doocs/leetcode) using [Gitpod.io](https://www.gitpod.io), a free online dev environment with a single click.
48+
[Gitpod.io](https://www.gitpod.io) 是一个免费的在线开发环境,你也可以使用它参与本项目。
3549

3650
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/doocs/leetcode)
3751

38-
## Contributors
39-
This project exists thanks to all the people who contribute.
52+
## 贡献者
53+
非常感谢以下所有朋友对本项目的贡献,你们是最可爱的人!
4054

41-
<a href="https://opencollective.com/doocs-leetcode/contributors.svg?width=890&button=true"><img src="https://opencollective.com/doocs-leetcode/contributors.svg?width=890&button=false" /></a>
55+
<a href="https://opencollective.com/doocs-leetcode/contributors.svg?width=890&button=true"><img src="https://opencollective.com/doocs-leetcode/contributors.svg?width=1200&button=false" /></a>
4256

43-
## License
44-
<a rel="license" href="https://github.com/doocs/leetcode/blob/master/LICENSE"><img alt="Creative Commons License" style="border-width:0" src="./img/cc-by-sa-88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
57+
## 许可证
58+
<a rel="license" href="https://github.com/doocs/leetcode/blob/master/LICENSE"><img alt="Creative Commons License" style="border-width:0" src="./img/cc-by-sa-88x31.png" /></a><br /><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">知识共享 版权归属-相同方式共享 4.0 国际 公共许可证</a>

README_EN.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<p align="center">
2+
<a href="https://github.com/doocs/leetcode"><img src="./img/leetcode-doocs.png" alt="LeetCode-GitHub-Doocs"></a>
3+
</p>
4+
5+
<p align="center">
6+
<a href="https://github.com/doocs/leetcode"><img src="https://badgen.net/badge/langs/Java,C++,Python,JavaScript,Go,.../green?list=1" alt="languages"></a>
7+
<a href="https://github.com/doocs/leetcode/stargazers"><img src="https://badgen.net/github/stars/doocs/leetcode" alt="stars"></a>
8+
<a href="https://github.com/doocs/leetcode/issues"><img src="https://badgen.net/github/open-issues/doocs/leetcode" alt="issues"></a>
9+
<a href="https://github.com/doocs/leetcode/network/members"><img src="https://img.shields.io/github/forks/doocs/leetcode.svg" alt="forks"></a>
10+
<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="http://makeapullrequest.com"><img src="https://badgen.net/badge/PRs/welcome/cyan" alt="PRs Welcome"></a>
12+
<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>
13+
</p>
14+
15+
## Introduction
16+
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.
17+
18+
[中文文档](/README.md)
19+
20+
## Sites
21+
- GitHub Pages: https://doocs.github.io/leetcode
22+
- Coding Pages: https://d3jc40.coding-pages.com
23+
24+
## Solutions
25+
- [LeetCode](/solution/README_EN.md)
26+
- [LCOF: *Coding Interviews, 2nd Edition*](/lcof/README_EN.md)
27+
- [LCCI: *Cracking the Coding Interview, 6th Edition*](/lcci/README_EN.md)
28+
29+
## Maintainer
30+
[Yang Libin](https://github.com/yanglbme): Creator of [@Doocs](https://github.com/doocs) technical community; member of [@TheAlgorithms](https://github.com/TheAlgorithms) organization.
31+
32+
## Contributions
33+
I'm looking for long-term contributors/partners to this repo! Send me [PRs](https://github.com/doocs/leetcode/pulls) if you're interested! See the following:
34+
35+
- <kbd>Fork</kbd> [this repository](https://github.com/doocs/leetcode) to your own GitHub account and then <kbd>clone</kbd> it to your local machine.
36+
- Make some changes to your leetcode repository, then <kbd>add</kbd>, <kbd>commit</kbd> and <kbd>push</kbd> the changes to your remote GitHub repository.
37+
- Submit a pull request with your changes!
38+
- See [CONTRIBUTING](https://github.com/doocs/.github/blob/master/CONTRIBUTING.md) or [GitHub Help](https://help.github.com/en) for more details.
39+
40+
<p align="center">
41+
<a href="https://github.com/doocs/leetcode"><img src="./img/how-to-contribute.png" alt="how-to-contribute"></a>
42+
</p>
43+
44+
You can also contribute to [doocs/leetcode](https://github.com/doocs/leetcode) using [Gitpod.io](https://www.gitpod.io), a free online dev environment with a single click.
45+
46+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/doocs/leetcode)
47+
48+
## Contributors
49+
This project exists thanks to all the people who contribute.
50+
51+
<a href="https://opencollective.com/doocs-leetcode/contributors.svg?width=890&button=true"><img src="https://opencollective.com/doocs-leetcode/contributors.svg?width=1200&button=false" /></a>
52+
53+
## License
54+
<a rel="license" href="https://github.com/doocs/leetcode/blob/master/LICENSE"><img alt="Creative Commons License" style="border-width:0" src="./img/cc-by-sa-88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.

img/favicon-16x16.png

1.36 KB
Loading

img/favicon-32x32.png

2.36 KB
Loading

index.html

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>LeetCode、剑指Offer、程序员面试金典题解</title>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7+
<meta name="keywords" content="doc,docs,doocs,documentation,github,gitee,coding,pages,leetcode,coding-interview,cracking-the-coding-interview,yanglbme">
8+
<meta name="description" content="LeetCode、剑指Offer、程序员面试金典题解">
9+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
10+
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
11+
<link rel="stylesheet" href="//unpkg.com/docsify-dark-mode@0.6.1/dist/style.css" />
12+
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
13+
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png">
14+
</head>
15+
16+
<body>
17+
<div id="app">本系列知识由 Doocs 开源社区原创发布</div>
18+
<script>
19+
window.$docsify = {
20+
name: 'leetcode',
21+
logo: '/img/doocs-leetcode.png',
22+
search: [
23+
'/','/solution/','/lcof/','lcci/'
24+
],
25+
auto2top: true,
26+
loadSidebar: 'summary.md',
27+
alias: {
28+
'/lcci/.*/summary.md': '/lcci/summary.md',
29+
'/lcof/.*/summary.md': '/lcof/summary.md',
30+
'/solution/.*/summary.md': '/solution/summary.md'
31+
},
32+
pagination: {
33+
previousText: '上一题',
34+
nextText: '下一题',
35+
crossChapter: true,
36+
crossChapterText: true
37+
},
38+
darkMode: {
39+
light: {
40+
toggleBtnBg: '#42b983'
41+
}
42+
},
43+
plugins: [
44+
function (hook) {
45+
var footer = [
46+
'<hr/>',
47+
'<footer>',
48+
'<span>Copyright © 2018-2020 <a href="https://github.com/doocs" target="_blank">Doocs</a>. All rights reserved.',
49+
'</footer>'
50+
].join('')
51+
52+
hook.afterEach(function (html) {
53+
return html + footer
54+
})
55+
},
56+
function (hook, vm) {
57+
hook.beforeEach(function (html) {
58+
if (/githubusercontent\.com/.test(vm.route.file)) {
59+
url = vm.route.file
60+
.replace('raw.githubusercontent.com', 'github.com')
61+
.replace(/\/master/, '/blob/master')
62+
} else {
63+
url = 'https://github.com/doocs/leetcode/blob/master/' + vm.route.file
64+
}
65+
var editHtml = '[:memo: Edit on GitHub](' + url + ')\n'
66+
return editHtml + html
67+
})
68+
},
69+
]
70+
}
71+
</script>
72+
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
73+
<script src="//unpkg.com/prismjs/components/prism-c.min.js"></script>
74+
<script src="//unpkg.com/prismjs/components/prism-go.min.js"></script>
75+
<script src="//unpkg.com/prismjs/components/prism-sql.min.js"></script>
76+
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
77+
<script src="//unpkg.com/prismjs/components/prism-cpp.min.js"></script>
78+
<script src="//unpkg.com/prismjs/components/prism-json.min.js"></script>
79+
<script src="//unpkg.com/prismjs/components/prism-java.min.js"></script>
80+
<script src="//unpkg.com/prismjs/components/prism-csharp.min.js"></script>
81+
<script src="//unpkg.com/prismjs/components/prism-javascript.min.js"></script>
82+
<script src="//unpkg.com/prismjs/components/prism-python.min.js"></script>
83+
<script src="//unpkg.com/docsify-copy-code"></script>
84+
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
85+
<script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
86+
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.js"></script>
87+
<script src="//unpkg.com/docsify-dark-mode@0.6.1/dist/index.js"></script>
88+
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
89+
</body>
90+
</html>

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+
```

0 commit comments

Comments
 (0)