Skip to content

Commit 00b93c5

Browse files
committedJul 2, 2019
Add Soulution.go for 0009.Palindrome Number
1 parent a5810d6 commit 00b93c5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
func isPalindrome(x int) bool {
2+
if x < 0 {
3+
return false
4+
}
5+
result := 0
6+
y := x
7+
for y != 0 {
8+
result = result * 10 + y%10
9+
y /= 10
10+
}
11+
return result == x
12+
}

0 commit comments

Comments
 (0)
Please sign in to comment.