3lines?Javascript way to solve it!


  • 0
    B
     * @param {number} x
     * @return {boolean}
     */
    var isPalindrome = function(x) {
        var str = x.toString();
        
        var reverseArr = str.split("").reverse().join("");
        
        //==to aviod making str to number
        return x==reverseArr?true:false;
        
    };

Log in to reply
 

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