Skip to content

Instantly share code, notes, and snippets.

@OlegKorn
Created October 12, 2022 07:07
Show Gist options
  • Save OlegKorn/2a52e06653e16faf509ea7d191cdd2a2 to your computer and use it in GitHub Desktop.
Save OlegKorn/2a52e06653e16faf509ea7d191cdd2a2 to your computer and use it in GitHub Desktop.
leetcode - Palindrom.js
/*
author Oleg Kornilov
kornilovoy@gmail.com
github.com/OlegKorn
https://leetcode.com/problems/palindrome-number/solution/
*/
var isPalindrome = function(x) {
x = x.toString()
for (var i = 0; i < x.length; i++) {
if (x.charAt(i) !== x.charAt(x.length - 1 - i)) {
return false
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment