Created
July 6, 2023 04:54
-
-
Save nickforce/19b0efd3e8af2efded49f8ebe6880cdb to your computer and use it in GitHub Desktop.
Palindrome Number (leetcode)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {number} x | |
* @return {boolean} | |
*/ | |
var isPalindrome = function(x) { | |
if(x < 0) return false; | |
if(x == 0) return true; | |
if(x.toFixed(0).split('').reverse().join('')-0 == x) return true; | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment