LeetCode: Valid Palindrome

No comments
Problem:
https://leetcode.com/problems/valid-palindrome/
class Solution {
public:
    bool isPalindrome(string s) {
        int n=s.length(),f=1;
 string temp="";
 for(int i=0;i<n;i++) 
 {
  if(isalpha(s[i])||isdigit(s[i]))
  temp+=tolower(s[i]);
 }
 int len=temp.length();
 for(int i=0;i<len/2;i++) 
 {
  if(temp[i]!=temp[len-i-1])
  {
   return false;
  }
 }
 return true;
    }
};

No comments :