Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd54abce

Browse files
committed
fix: fix some
1 parent05de575 commitd54abce

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

‎note/006/README.md

Lines changed: 2 additions & 2 deletions
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

Lines changed: 9 additions & 7 deletions
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-
publicboolean isPalindrome(int x) {
46-
if (x<0|| (x!=0&& x%10==0))returnfalse;
47-
int halfReverseX=0;
48-
while (x> halfReverseX) {
49-
halfReverseX= halfReverseX*10+ x%10;
50-
x/=10;
45+
classSolution {
46+
publicbooleanisPalindrome(intx) {
47+
if (x<0|| (x!=0&& x%10==0))returnfalse;
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

Lines changed: 1 addition & 1 deletion
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
classSolution {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp