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 7d67040 commit bb59e8aCopy full SHA for bb59e8a
125-Valid-Palindrome.java
@@ -0,0 +1,20 @@
1
+class Solution {
2
+ public boolean isPalindrome(String s) {
3
+ int left=0;
4
+ int right = s.length()-1;
5
+ while(left<=right){
6
+ if(!Character.isLetterOrDigit(s.charAt(left))){
7
+ left++;
8
+ continue;
9
+ }
10
+ else if(!Character.isLetterOrDigit(s.charAt(right))){
11
+ right--;
12
13
+ }else if((Character.toLowerCase(s.charAt(left))!=Character.toLowerCase(s.charAt(right))))
14
+ return false;
15
16
17
18
+ return true;
19
20
+}
0 commit comments