C++ sol with O(n) time complexity


#1

int Solution::isPalindrome(string A) {
string s="";
for(int i=0;i<A.length();i++)
{
if(A[i]>=48&&A[i]<=57)
s+=A[i];
if(A[i]>=97&&A[i]<=122)
s+=A[i];

    if(A[i]>=65&&A[i]<=90)
    {
        A[i]=A[i]+32;
        s+=A[i];
    }
    
}

string s1=s;
reverse(s.begin(),s.end());

if(s==s1)
    return 1;
else
    return 0;

}