5.LeetCode(初级算法)字符串篇-验证回文字符串C++

class Solution {
public:
    bool isPalindrome(string s) {
        if(s.size()==0) return true;
        string s_temp;
        for(auto c : s)
        {
            if(c>='0' && c<='9')
            {
                s_temp.push_back(c);
            }else if(c>='a' && c<='z')
            {
                s_temp.push_back(c);
            }else if(c>='A' && c<='Z')
            {
                s_temp.push_back(c-('A'-'a'));
            }
        }
        if(s_temp.size()==0) return true;
        for(int i=0; i

你可能感兴趣的:(LeetCode)