Skip to content

Commit d54abce

Browse files
committed
fix: fix some
1 parent 05de575 commit d54abce

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

note/006/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Longest Palindromic Substring][title]
1+
# [ZigZag Conversion][title]
22

33
## Description
44

@@ -106,5 +106,5 @@ class Solution {
106106

107107

108108

109-
[title]: https://leetcode.com/problems/longest-palindromic-substring
109+
[title]: https://leetcode.com/problems/zigzag-conversion
110110
[ajl]: https://github.com/Blankj/awesome-java-leetcode

note/009/README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ class Solution {
4242
好好思考下是否需要计算整个长度,比如 1234321,其实不然,我们只需要计算一半的长度即可,就是在计算过程中的那个逆序数比不断除 10 的数大就结束计算即可,但是这也带来了另一个问题,比如 10 的倍数的数 10010,它也会返回 `true`,所以我们需要对 10 的倍数的数再加个判断即可,代码如下所示。
4343

4444
```java
45-
public boolean isPalindrome(int x) {
46-
if (x < 0 || (x != 0 && x % 10 == 0)) return false;
47-
int halfReverseX = 0;
48-
while (x > halfReverseX) {
49-
halfReverseX = halfReverseX * 10 + x % 10;
50-
x /= 10;
45+
class Solution {
46+
public boolean isPalindrome(int x) {
47+
if (x < 0 || (x != 0 && x % 10 == 0)) return false;
48+
int halfReverseX = 0;
49+
while (x > halfReverseX) {
50+
halfReverseX = halfReverseX * 10 + x % 10;
51+
x /= 10;
52+
}
53+
return halfReverseX == x || halfReverseX / 10 == x;
5154
}
52-
return halfReverseX == x || halfReverseX / 10 == x;
5355
}
5456
```
5557

note/069/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Explanation: The square root of 8 is 2.82842..., and since we want to return an
2828

2929
## 思路
3030

31-
题意是求平方根,参考[牛顿迭代法求平方根](https://wenku.baidu.com/view/6b74c622bcd126fff7050bfe.html),然后再参考维基百科的[Integer square root](https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division)即可。
31+
题意是求平方根,参考 [牛顿迭代法求平方根](https://wenku.baidu.com/view/6b74c622bcd126fff7050bfe.html),然后再参考维基百科的 [Integer square root](https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division) 即可。
3232

3333
```java
3434
class Solution {

0 commit comments

Comments
 (0)