File tree Expand file tree Collapse file tree 8 files changed +134
-10
lines changed Expand file tree Collapse file tree 8 files changed +134
-10
lines changed Original file line number Diff line number Diff line change 1
1
node_modules
2
- . /docs /.vuepress /dist
2
+ . /docs /.vuepress /dist
3
+ .DS_Store
Original file line number Diff line number Diff line change 1
- ## Nice Notes
1
+ <div align =" center " >
2
+ <a href =" https://guanpengchn.github.io/LeetCodeDrawing/ " >
3
+ <img width =" 600 " src =" ./img/logo.png " />
4
+ </a >
5
+ </div >
6
+ <h1 align =" center " >LeetCode Drawing</h1 >
7
+ <p >LeetCode上第二多的精选题解,神奇的画解算法</p >
2
8
3
- - 记录【牧码啦】公众号中的文集
4
- - 包含算法题解、Java源码解析和开源分享
5
- - 欢迎阅读,[ 阅读地址] ( https://guanpengchn.github.io/nice-notes/ )
9
+ ---
6
10
7
- ## 使用方法
11
+ ## 简介
12
+
13
+ - 文章首发于微信公众号「[ 牧码啦] ( https://i.loli.net/2019/05/20/5ce23b33cc01d73486.gif ) 」,您可以关注后获取文章更新。
14
+ - 每日更新一题,欢迎关注后加入天天算法群,一起打卡学算法。
15
+ - 文章发布公众号后,会同步更新[ 力扣] ( https://leetcode-cn.com/ ) 和本项目的[ 在线阅读] ( https://guanpengchn.github.io/LeetCodeDrawing/ )
16
+
17
+ ## 打卡记录
18
+
19
+ ### 2019.05
20
+
21
+ ## 2019.05
22
+
23
+ | 周日| 周一| 周二| 周三| 周四| 周五| 周六|
24
+ | :-:| :-:| :-:| :-:| :-:| :-:| :-:|
25
+ |||||| [ 884] ( https://mp.weixin.qq.com/s/VOXoMQg57gdUmwo4553Uag ) | [ 216] ( https://mp.weixin.qq.com/s/XDpewlE0OUE1DYYE-XdoEg ) |
26
+ [ 112] ( https://mp.weixin.qq.com/s/_NdAjbWlYDV7z7LvMpuyDA ) |[ 938] ( https://mp.weixin.qq.com/s/ni6l_a1QMCi2sKuZDNoe4Q ) |[ 96] ( https://mp.weixin.qq.com/s/DEdiaun-RVwRj-9zx9brjw ) |[ 101] ( https://mp.weixin.qq.com/s/9xiQ8KmTLk_gxf7lsie9dA ) |[ 162] ( https://mp.weixin.qq.com/s/5HQ5zVPYdUAE4eVJBFKIoQ ) |[ 674] ( https://mp.weixin.qq.com/s/jSUM4rmYXatKfrjACEdwvw ) |
27
+ | [ 704] ( https://mp.weixin.qq.com/s/mnfLuH1nU8ghShgOhw-KBg ) | [ 77] ( https://mp.weixin.qq.com/s/VOV5wMsfrLW21ZkqXSfeeA ) ||| [ 520] ( https://mp.weixin.qq.com/s/YJTFk4xEOM9cDM-GQq_EIQ ) | [ 242] ( https://mp.weixin.qq.com/s/nvxS4p3lXvAL21dDbJo8QA ) | [ 1] ( https://mp.weixin.qq.com/s/jC4BsJ5r6QixdnwTIchTQw ) |
28
+
29
+
30
+ ## 2019.06
31
+
32
+ | 周日| 周一| 周二| 周三| 周四| 周五| 周六|
33
+ | :-:| :-:| :-:| :-:| :-:| :-:| :-:|
34
+ ||||||| [ 152] ( https://mp.weixin.qq.com/s/FvA_wcLq4JU70nXK6lrFHA ) |
35
+ | [ 171] ( https://mp.weixin.qq.com/s/jC4BsJ5r6QixdnwTIchTQw ) | [ 16] ( https://mp.weixin.qq.com/s/IBEJdeU6G-sBSMuv02LrHg ) | [ 24] ( https://mp.weixin.qq.com/s/_bjKxIrmtwU0IPtyWtKd_g ) | [ 2] ( https://mp.weixin.qq.com/s/8cMt_Yaeu6AT5jk3DhdhqA ) | [ 3] ( https://mp.weixin.qq.com/s/O-2CdSJTFWodVZzGYAjGrA ) |
36
+
37
+ ## 本地运行
38
+
39
+ 在线阅读基于VuePress
8
40
9
41
``` bash
42
+ // 安装
43
+ $ yarn
10
44
// 运行
11
45
$ yarn dev
12
46
// 部署
13
47
$ yarn deploy
14
- ```
48
+ ```
49
+
50
+ ## 联系作者
51
+
52
+ <div align =" center " >
53
+ <img width =" 600 " src =" ./img/erweima.gif " />
54
+ </div >
Original file line number Diff line number Diff line change @@ -8,6 +8,6 @@ cd docs/.vuepress/dist
8
8
git init
9
9
git add -A
10
10
git commit -m ' deploy'
11
- git push -f
[email protected] :guanpengchn/
nice-notes .git master:gh-pages
11
+ git push -f
[email protected] :guanpengchn/
LeetCodeDrawing .git master:gh-pages
12
12
13
13
cd -
Original file line number Diff line number Diff line change 1
- Subproject commit c4e0eab51a64390ce7c70391e7fe207a9a0ef68a
1
+ Subproject commit 2c64c53ad2591cdfd4fa484f95a8348220e30958
Original file line number Diff line number Diff line change
1
+
2
+ # 画解算法:9. 回文数
3
+
4
+ ## 题目链接
5
+
6
+ https://leetcode-cn.com/problems/palindrome-number/
7
+
8
+ ## 题目描述
9
+
10
+ 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。
11
+
12
+ 示例 1:
13
+
14
+ ``` bash
15
+ 输入: 121
16
+ 输出: true
17
+ ```
18
+
19
+ 示例 2:
20
+
21
+ ``` bash
22
+ 输入: -121
23
+ 输出: false
24
+ 解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。
25
+ ```
26
+
27
+ 示例 3:
28
+
29
+ ``` bash
30
+ 输入: 10
31
+ 输出: false
32
+ 解释: 从右向左读, 为 01 。因此它不是一个回文数。
33
+ ```
34
+
35
+ ## 解题方案
36
+
37
+ ### 思路
38
+
39
+ - 标签:数学
40
+ - 如果是负数则一定不是回文数,直接返回false
41
+ - 如果是正数,则将其倒序数值计算出来,然后比较和原数值是否相等
42
+ - 如果是回文数则相等返回true,如果不是则不相等false
43
+ - 比如123的倒序321,不相等;121的倒序121,相等
44
+
45
+ ### 代码
46
+
47
+ ``` java
48
+ class Solution {
49
+ public boolean isPalindrome (int x ) {
50
+ if (x < 0 )
51
+ return false ;
52
+ int cur = 0 ;
53
+ int num = x;
54
+ while (num != 0 ) {
55
+ cur = cur * 10 + num % 10 ;
56
+ num /= 10 ;
57
+ }
58
+ return cur == x;
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### 画解
64
+
65
+ ![ fr< ; x> ; ame_00001.png] ( https://i.loli.net/2019/06/06/5cf88fae1022717169.png )
66
+ ![ fr< ; x> ; ame_00002.png] ( https://i.loli.net/2019/06/06/5cf88fae06ae063620.png )
67
+ ![ fr< ; x> ; ame_00003.png] ( https://i.loli.net/2019/06/06/5cf88fae26f3863032.png )
68
+
69
+
70
+ <span style =" display :block ;text-align :center ;" >点击「<strong >阅读原文</strong >」在PC端评论打卡</span >
71
+ <span style =" display :block ;text-align :center ;" >后台回复「<strong >算法</strong >」,加入天天算法群</span >
72
+ <span style =" display :block ;text-align :center ;" >觉得算法直击灵魂,欢迎点击<strong >在看</strong >和<strong >转发</strong ></span >
73
+
74
+ ![ ] ( https://i.loli.net/2019/05/20/5ce23b33cc01d73486.gif )
Original file line number Diff line number Diff line change 6
6
| :-:| :-:| :-:| :-:| :-:| :-:| :-:|
7
7
|||||| [ 884] ( https://mp.weixin.qq.com/s/VOXoMQg57gdUmwo4553Uag ) | [ 216] ( https://mp.weixin.qq.com/s/XDpewlE0OUE1DYYE-XdoEg ) |
8
8
[ 112] ( https://mp.weixin.qq.com/s/_NdAjbWlYDV7z7LvMpuyDA ) |[ 938] ( https://mp.weixin.qq.com/s/ni6l_a1QMCi2sKuZDNoe4Q ) |[ 96] ( https://mp.weixin.qq.com/s/DEdiaun-RVwRj-9zx9brjw ) |[ 101] ( https://mp.weixin.qq.com/s/9xiQ8KmTLk_gxf7lsie9dA ) |[ 162] ( https://mp.weixin.qq.com/s/5HQ5zVPYdUAE4eVJBFKIoQ ) |[ 674] ( https://mp.weixin.qq.com/s/jSUM4rmYXatKfrjACEdwvw ) |
9
- | [ 704] ( https://mp.weixin.qq.com/s/mnfLuH1nU8ghShgOhw-KBg ) |
9
+ | [ 704] ( https://mp.weixin.qq.com/s/mnfLuH1nU8ghShgOhw-KBg ) | [ 77] ( https://mp.weixin.qq.com/s/VOV5wMsfrLW21ZkqXSfeeA ) ||| [ 520] ( https://mp.weixin.qq.com/s/YJTFk4xEOM9cDM-GQq_EIQ ) | [ 242] ( https://mp.weixin.qq.com/s/nvxS4p3lXvAL21dDbJo8QA ) | [ 1] ( https://mp.weixin.qq.com/s/jC4BsJ5r6QixdnwTIchTQw ) |
10
+
11
+
12
+ ## 2019.06
13
+
14
+ | 周日| 周一| 周二| 周三| 周四| 周五| 周六|
15
+ | :-:| :-:| :-:| :-:| :-:| :-:| :-:|
16
+ ||||||| [ 152] ( https://mp.weixin.qq.com/s/FvA_wcLq4JU70nXK6lrFHA ) |
17
+ | [ 171] ( https://mp.weixin.qq.com/s/jC4BsJ5r6QixdnwTIchTQw ) | [ 16] ( https://mp.weixin.qq.com/s/IBEJdeU6G-sBSMuv02LrHg ) | [ 24] ( https://mp.weixin.qq.com/s/_bjKxIrmtwU0IPtyWtKd_g ) | [ 2] ( https://mp.weixin.qq.com/s/8cMt_Yaeu6AT5jk3DhdhqA ) | [ 3] ( https://mp.weixin.qq.com/s/O-2CdSJTFWodVZzGYAjGrA ) |
18
+
You can’t perform that action at this time.
0 commit comments