LeetCode 8

static const auto _____ = []()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    return nullptr;
}();

class Solution {
public:
    bool isPalindrome(int x) {
        if(x<0)
            return false;
        
        int y = x,z=0;
        
        while(y){
            z*=10;
            z+=(y%10);
            y=y/10;
        }
        
        if(x==z)
            return true;
        
        return false;
    }
};

 

posted @ 2018-09-13 11:41  一只狐狸scse  阅读(62)  评论(0编辑  收藏  举报