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.
1 parent 6df5759 commit d740e70Copy full SHA for d740e70
valid-palindrome/sm9171.java
@@ -0,0 +1,12 @@
1
+class Solution {
2
+ public boolean isPalindrome(String s) {
3
+ String str = s.toLowerCase().replaceAll("[^a-z0-9]","");
4
+ char[] charArray = str.toCharArray();
5
+ for (int i = 0; i < charArray.length / 2; i++) {
6
+ if (charArray[i] != charArray[charArray.length - i - 1]) {
7
+ return false;
8
+ }
9
10
+ return true;
11
12
+}
0 commit comments