class Solution {
public:
bool isPalindrome(string s) {
transform(s.begin(), s.end(), s.begin(), ::tolower);
auto first = s.begin(), last = prev(s.end());
while(first < last){
if(!::isalnum(*first)) ++first;
else if(!::isalnum(*last)) --last;
else if(*first != *last) return false;
else {++first, --last;}
}
return true;
}
};
解法1:
class Solution {
public:
int