回文数 (Palindrome Number)

 

思路:

// @Title: 回文数 (Palindrome Number)
// @Author: qisiii
// @Date: 2022-03-01 22:09:19
// @Runtime: 6 ms
// @Memory: 41 MB
// @comment: 
// @flag: 
class Solution {
    public boolean isPalindrome(int x) {
        char[] shuzu=String.valueOf(x).toCharArray();
        for(int i=0;i<shuzu.length/2;i++){
            if(shuzu[i]==shuzu[shuzu.length-1-i]){
                continue;
            }else{
                return false;
            }
        }
        return true;
    }
}
Licensed under CC BY-NC-SA 4.0
最后更新于 2024-10-18