Skip to content

Commit 8e25a7e

Browse files
committed
Time: 127 ms (8.51%), Space: 45.7 MB (13.23%) - LeetHub
1 parent 47fdeb3 commit 8e25a7e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public boolean isPalindrome(String s) {
3+
String check = "";
4+
for(int i = 0; i<s.length();i++){
5+
if(Character.isLetterOrDigit(s.charAt(i))){
6+
check += s.charAt(i);
7+
}
8+
}
9+
check = check.toLowerCase();
10+
int x = check.length()-1;
11+
for(int i = 0; i<x; i++){
12+
if(check.charAt(i)!=check.charAt(x)){
13+
return false;
14+
}
15+
x--;
16+
}
17+
return true;
18+
}
19+
}

0 commit comments

Comments
 (0)