6-line JavaScript Code


  • 0
    V
    var isPalindrome = function(x) {
        x = x.toString();
        for(var i = 0, l = x.length, j = l-1; i < l/2; i++, j--) 
            if(x[i] != x[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.