Skip to content

Commit 1050270

Browse files
authored
Merge pull request gzc426#189 from zyzhuaidan/master
1
2 parents 002cf75 + 1da60c5 commit 1050270

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

2018.11.27-leetcode125/tongLuoWan.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
>leetcode 125. Valid Palindrome
2+
3+
```
4+
class Solution {
5+
6+
public boolean isPalindrome(String s) {
7+
if(s.length()==0)
8+
return true;
9+
s=s.toLowerCase();
10+
int i = 0, j = s.length()- 1;
11+
while (i<j){
12+
if(!Character.isLetterOrDigit(s.charAt(i)))
13+
i++;
14+
else if(!Character.isLetterOrDigit(s.charAt(j)))
15+
j--;
16+
else if(s.charAt(i) != s.charAt(j))
17+
return false;
18+
else{ i++;j--;}
19+
}
20+
return true;
21+
}
22+
}
23+
```
24+
>2018.11.27号打卡

0 commit comments

Comments
 (0)