Given a string, determine if it is a palindrome. considering only alphanumeric characters and ignoring cases.
Notes:
Have you consider the string might be empty?
class Solution{
bool isPalindrome(string s){
if(s.empty()) return true;
int i = 0, j = s.size()-1;
while(i < j){
if(!isalnum(s[i])){
i++;
continue;
}
if(!isalnum(s[j])){
j++;
continue;
}
if(tolower(s[i]) == tolower(s[j]))
return false;
i++; j--;
}
return true;
}
};