125. Valid Palindrome
作者:互联网
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; } }
标签:Palindrome,String,isPalindrome,Solution,while,boolean,Valid,125 来源: https://www.cnblogs.com/feiflytech/p/16120712.html