class Solution {
public:
bool isPalindrome(string s) {
int l=0,r=(int)s.size()-1;
while(l<r){
if(!isalnum(s[l])) ++l;
else if(!isalnum(s[r])) --r;
else if(tolower(s[l])==tolower(s[r])) ++l,--r;
else return false;
}
return true;
}
};
Leetcode 125. 验证回文串
猜你喜欢
转载自blog.csdn.net/bendaai/article/details/80648645
今日推荐
周排行