首页 > 其他 > 详细

LeetCode 8: Palindrome Number

时间:2015-06-02 09:23:36      阅读:79      评论:0      收藏:0      [点我收藏+]

Determine whether an integer is a palindrome. Do this without extra space.


本题是判断一个数是否是回文数。

代码如下:

bool isPalindrome(int x) {
    int max = x;
        int min = 0;
        while(max >0){
            min *= 10;
            min+= max %10;
            max /=10;
        }
        return min==x;
    
}


LeetCode 8: Palindrome Number

原文:http://blog.csdn.net/sunao2002002/article/details/46318421

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!