Skip to content

Instantly share code, notes, and snippets.

@spurscho
Created December 23, 2019 11:23
Show Gist options
  • Save spurscho/b02ea822e33b68b7e2d20b7191391a3d to your computer and use it in GitHub Desktop.
Save spurscho/b02ea822e33b68b7e2d20b7191391a3d to your computer and use it in GitHub Desktop.
9. Palindrome Number
class Solution {
func isPalindrome(_ x: Int) -> Bool {
if x < 0 {
return false
}
let arr = String(x)
let revArr = String(x).reversed()
if arr == String(revArr) {
return true
} else {
return false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment