Skip to content

Commit 5da4a5d

Browse files
Merge pull request apachecn#19 from jiangzhonglian/master
更新 readme 模版
2 parents 496025c + 95447b1 commit 5da4a5d

File tree

5 files changed

+87
-15
lines changed

5 files changed

+87
-15
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,35 @@
33
* 英文官网: https://leetcode.com
44
* 中文官网: https://leetcode-cn.com
55

6-
## 1.LeetCode 习题集合
6+
> <font color=red>slogan: **不想装逼的朋友,我们都不想认识**</font>
7+
8+
* **LeetCode 刷题群 | ApacheCN【812791932】<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=1d390faa76fe789a0068dadae4ab9b0f0fc7997c38f216e9a30172866163a49d"><img border="0" src="/images/MainPage/ApacheCN-group.png" alt="LeetCode 刷题 | ApacheCN " title="LeetCode 刷题 | ApacheCN "></a>**
9+
* [<font color=green>ApacheCN repo 地址</font>](https://github.com/apachecn/leetcode): https://github.com/apachecn/leetcode
10+
* **<font color=green>ApacheCN 网友捐赠页面</font>:http://www.apachecn.org/organization/664.html**
11+
12+
## LeetCode 习题集合
713

814
* [LeetCode 习题集合](/docs/Leetcode_Solutions)
915

10-
## 2.算法 集合
16+
## 算法 汇总集合
1117

12-
* [算法 集合](/docs/Algorithm)
18+
* [算法 汇总集合](/docs/Algorithm)
1319
* [八大排序算法 集合](/docs/Algorithm/Sort)
1420
* [Wikipedia: List of Algorithms](https://en.wikipedia.org/wiki/List_of_algorithms)
1521

16-
## 推荐的一些LeetCode网站
22+
## 模版要求
23+
24+
> 基本要求(提交PR前)
25+
26+
* 要不:有不一样的思路
27+
* 要不:优化时间复杂度和空间复杂度
28+
* 要不:简化代码
29+
30+
> **案例模版**
31+
32+
[模版:1. Two Sum 两数之和](/docs/Leetcode_Solutions/001._two_sum.md)
33+
34+
## 推荐 LeetCode 网站
1735

1836
1. [KrisYu的Github](https://github.com/KrisYu/LeetCode-CLRS-Python)
1937
2. [kamyu104的Github](https://github.com/kamyu104/LeetCode)
@@ -27,8 +45,13 @@
2745
10. [小土刀的面试刷题笔记](http://wdxtub.com/interview/14520594642530.html)
2846
11. [nonstriater/Learn-Algorithms](https://github.com/nonstriater/Learn-Algorithms)
2947
12. [剑指 Offer 题解](https://github.com/gatieme/CodingInterviews)
48+
13. https://algorithm.yuanbin.me/zh-hans
49+
14. https://github.com/liuchuo/LeetCode
50+
15. https://github.com/anxiangSir/SwordforOffer
51+
16. https://www.nowcoder.com/ta/coding-interviews?page=1
52+
17. 【小姐姐】刷题博客:https://www.liuchuo.net/about
3053

31-
### Please note, this repository is inspired from [KrisYu](https://github.com/KrisYu/LeetCode-CLRS-Python). However, it has been modified, added and improved to reflect our knowledge, wisdom and effort.
54+
> Please note, this repository is inspired from [KrisYu](https://github.com/KrisYu/LeetCode-CLRS-Python). However, it has been modified, added and improved to reflect our knowledge, wisdom and effort.
3255
3356
- 💪 就是干!如果你觉得有帮助请点个star,谢谢!
3457

docs/Leetcode_Solutions/001._two_sum.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# 1. Two Sum 两数之和
22

3-
## 题目:
3+
**<font color=red>难度: Easy</font>**
44

5-
* https://leetcode.com/problems/two-sum/
6-
* https://leetcode-cn.com/problems/two-sum/description/
5+
## 刷题内容
6+
7+
> 原题连接
8+
9+
* https://leetcode.com/problems/two-sum
10+
* https://leetcode-cn.com/problems/two-sum/description
11+
12+
> 内容描述
713
814
```
915
给定 nums = [2, 7, 11, 15], target = 9
@@ -12,7 +18,7 @@
1218
所以返回 [0, 1]
1319
```
1420

15-
## 难度: Easy
21+
## 解决方案
1622

1723
> 思路 1
1824

docs/Leetcode_Solutions/007._Reverse_Integer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ class Solution:
102102
"""
103103
mark = 1 if x>=0 else -1
104104
x_abs = abs(x)
105-
result = mark * int(''.join(str(x_abs)[::-1]))
105+
result = mark * int(str(x_abs)[::-1])
106106
return result if -2**31 <= result <= 2**31-1 else 0
107107
```

docs/Leetcode_Solutions/009._Palindrome_Number.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
1-
### 9. Palindrome Number
1+
# 9. Palindrome Number 回文数
22

3-
题目:
4-
<https://leetcode.com/problems/palindrome-number/>
3+
## 题目
54

6-
难度:
7-
Medium
5+
* https://leetcode.com/problems/palindrome-number
6+
* https://leetcode-cn.com/problems/palindrome-number/description
87

8+
```
9+
判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。
10+
11+
示例 1:
12+
13+
输入: 121
14+
输出: true
15+
示例 2:
16+
17+
输入: -121
18+
输出: false
19+
解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。
20+
示例 3:
21+
22+
输入: 10
23+
输出: false
24+
解释: 从右向左读, 为 01 。因此它不是一个回文数。
25+
进阶:
26+
27+
你能不将整数转为字符串来解决这个问题吗?
28+
```
29+
30+
## 难度:Medium
31+
32+
> 思路1
933
1034
- 首先负数肯定不是palindrome
1135
- 其次如果一个数字是一个正数,并且能被我0整除那它肯定也不是palindrome
@@ -29,3 +53,22 @@ class Solution(object):
2953

3054
```
3155

56+
> 思路2
57+
58+
* 排除小于0的数
59+
* 通过字符串进行反转,对比数字是否相等就行
60+
61+
```python
62+
class Solution:
63+
def isPalindrome(self, x):
64+
"""
65+
:type x: int
66+
:rtype: bool
67+
"""
68+
if x < 0:
69+
return False
70+
elif x != int(str(x)[::-1]):
71+
return False
72+
else:
73+
return True
74+
```

images/MainPage/ApacheCN-group.png

1.78 KB
Loading

0 commit comments

Comments
 (0)