Passed clean c++ code


  • 29
    L
    bool isPalindrome(string s) {
    	int start=0, end=s.length()-1;
    	while(start<end) {
    		if (!isalnum(s[start])) start++;
    		else if (!isalnum(s[end])) end--;
    		else {
    			if (tolower(s[start++])!=tolower(s[end--])) return false;
    		}
    	}
    	return true;
    }

  • 0
    S

    good!I use two while,but I think that your solution is better!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.