You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
287 B

package palindromenumber
import "strconv"
func isPalindrome(x int) bool {
str := []rune(strconv.Itoa(x))
for i, digit := range str {
if digit != str[len(str)-i-1] {
return false
}
}
return true
}
// public for test
func IsPalindrome(x int) bool {
return isPalindrome(x)
}