148ms JavaScript Solution


  • 0
    E

    Here's my solutions that took 148ms and is currently the fastest solution submitted using JS.

    /**
     * @param {string} s
     * @return {boolean}
     */
    var isPalindrome = function(s) {
        s = s.toLowerCase().replace(/[^a-z0-9]/g, '');
        return s === s.split('').reverse().join('');
    };

Log in to reply
 

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