diff --git a/leetcode-com-explore-challenge-card-august-leetcoding-challenge-549-week-1-august-1st-august-7th-3411(a).cpp b/leetcode-com-explore-challenge-card-august-leetcoding-challenge-549-week-1-august-1st-august-7th-3411(a).cpp new file mode 100644 index 0000000..741ee67 --- /dev/null +++ b/leetcode-com-explore-challenge-card-august-leetcoding-challenge-549-week-1-august-1st-august-7th-3411(a).cpp @@ -0,0 +1,46 @@ +class Solution { +public: + bool isPalindrome(string s) { + if(s.length()==0){ + return true; + } + int i=0,j=s.length()-1; + while(i<=j){ + if((s[i]>=48 and s[i]<=57) or (s[i]>=65 and s[i]<=90) or (s[i]>=97 and s[i]<=122)){ + if((s[j]>=48 and s[j]<=57) or (s[j]>=65 and s[j]<=90) or (s[j]>=97 and s[j]<=122)){ + if(s[i]>=48 and s[i]<=57){ + if(s[i]==s[j]){ + i++; + j--; + }else{ + return false; + } + } + else if((s[i]>=65 and s[i]<=90) or (s[i]>=97 and s[i]<=122)){ + if(s[i]==s[j] or s[i]+32==s[j] or s[i]==s[j]+32){ + i++; + j--; + } + else{ + return false; + } + } + + + } + else{ + j--; + } + }else{ + i++; + } + } + if(i>j){ + return true; + }else{ + return false; + } + + +} +}; \ No newline at end of file