【Leetcode】(number of palindrome with 9 palindrome per day)

Insert picture description here
Code implementation:
borrowing a wonderful method, the two numbers are equal after inversion

bool isPalindrome(int x){
    
    
    if(x<0)
    return false;//直接杀死负数

    long y=0;
    int temp=x;
    while(temp!=0){
    
    
        y=y*10+temp%10;
        temp/=10;
    }
    if(y==x)
    {
    
    
        return true;
    }
    return false;
}

Guess you like

Origin blog.csdn.net/qq_45657288/article/details/106086948