Javascript code, beat 100 % of javascript submissions


  • 0
    P

    /**

    • @param {number} x
    • @return {boolean}
      /
      var isPalindrome = function(x) {
      var no=x,rem=0,rev=0;
      while(no>0) {
      rem=no%10;
      rev=rev
      10+rem;
      no=Math.floor(no/10);
      }
      if(rev==x)
      return true;
      else
      return false;
      };

Log in to reply
 

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