class Solution {
func isPalindrome(_ x: Int) -> Bool {
let str = "\(x)";
var arr:[String] = []
for i in str{
arr.append(String(i))
}
var isTrue = true
for i in 0..<arr.count/2 {
if arr[i] != arr[arr.count - 1 - i]{
isTrue = false
}
}
return isTrue
}
}
网友评论