JavaScript solution


  • 0
    var isPalindrome = function(s) {
        s = s.toLowerCase().replace(/\W+/g, "");
        for (var i = 0, j = s.length - 1; i < j; i++, j--) {
            if (s[i] != s[j]) return false;
        }
        return true;
    };
    

Log in to reply
 

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