Javascript solution, if anyone is interested


  • 4
    P
    var isPalindrome = function(s) {
        var strippedString = s.replace(/\W/g, '');
        var reversedString = strippedString.split('').reverse().join('');
        
        return strippedString.toLowerCase() == reversedString.toLowerCase();
    };

Log in to reply
 

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