Created
December 23, 2019 11:23
-
-
Save spurscho/b02ea822e33b68b7e2d20b7191391a3d to your computer and use it in GitHub Desktop.
9. Palindrome Number
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
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