We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c965226 + 57ecdb9 commit a46a1d0Copy full SHA for a46a1d0
2018.11.27-leetcode125/str818.md
@@ -0,0 +1,23 @@
1
+```java
2
+public boolean isPalindrome(String s) {
3
+ if (s.isEmpty()) return true;
4
+ int head = 0, tail = s.length() - 1;
5
+ char cHead, cTail;
6
+ while(head <= tail) {
7
+ cHead = s.charAt(head);
8
+ cTail = s.charAt(tail);
9
+ if (!Character.isLetterOrDigit(cHead)) {
10
+ head++;
11
+ } else if(!Character.isLetterOrDigit(cTail)) {
12
+ tail--;
13
+ } else {
14
+ if (Character.toLowerCase(cHead) != Character.toLowerCase(cTail)) {
15
+ return false;
16
+ }
17
18
19
20
21
+ return true;
22
+}
23
+```
0 commit comments