class Solution { public boolean isPalindrome(String s) { s= s.toLowerCase(); int i=0, j=s.length()-1; while(i<j){ char a = s.charAt(i); char b = s.charAt(j); if(!(Character.isLetter(a)||Character.isDigit(a))){ i++; continue; } if(!(Character.isLetter(b)||Character.isDigit(b))){ j--; continue; } if(a!=b) return false; i++; j--; } return true; } }