class Solution {
public boolean isPalindrome(int x) {
String a = x + "";
for (int i = 0 ; i < (a.length() / 2) ; i++) {
if (a.charAt(i) != a.charAt(a.length()-i-1)) {
return false;
}
}
return true;
}
}
No comments:
Post a Comment