public class Solution {
public boolean isPalindrome(int x) {
if (x<0 || (x!=0 && x%10==0)) return false; int div = 1;
while(x/10>=div)
div *= 10;
while(x>0)
{
if(x/div!=x%10)
return false;
x = (x%div)/10;
div /= 100;
}
return true; }
}

[Leetcode]009.Palindrome Number的更多相关文章

  1. 【JAVA、C++】LeetCode 009 Palindrome Number

    Determine whether an integer is a palindrome. Do this without extra space. 解题思路一: 双指针法,逐位判断 Java代码如下 ...

  2. No.009 Palindrome Number

    9. Palindrome Number Total Accepted: 136330 Total Submissions: 418995 Difficulty: Easy Determine whe ...

  3. LeetCode--No.009 Palindrome Number

    9. Palindrome Number Total Accepted: 136330 Total Submissions: 418995 Difficulty: Easy Determine whe ...

  4. Leetcode练习题 Palindrome Number

    9. Palindrome Number Question: Determine whether an integer is a palindrome. An integer is a palindr ...

  5. Leetcode 9. Palindrome Number(水)

    9. Palindrome Number Easy Determine whether an integer is a palindrome. An integer is a palindrome w ...

  6. 【LeetCode】009. Palindrome Number

    Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negativ ...

  7. leetcode 9 Palindrome Number 回文数

    Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...

  8. LeetCode 9. Palindrome Number (回文数字)

    Determine whether an integer is a palindrome. Do this without extra space. 题目标签:Math 题目给了我们一个int x, ...

  9. Leetcode 9. Palindrome Number(判断回文数字)

    Determine whether an integer is a palindrome. Do this without extra space.(不要使用额外的空间) Some hints: Co ...

随机推荐

  1. 立方体贴图(Cubemap)

    http://blog.csdn.net/asdjy123/article/details/51190643 点击打开链接 好东西保存方便查看 立方体贴图(Cubemap) 原文 Cubemaps 作 ...

  2. bzoj 1711 Dining吃饭 —— 最大流

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1711 食物一列,牛拆点,饮料一列. 代码如下: #include<cstdio> ...

  3. mongodb数据迁移的两种方式

    环境说明:bbs数据采集的数据越来越多,目前是50G,每天大概以200W的数据量增长.而当前服务器1.2上面的空间不足,需要把数据迁移到空间足够大的1.3上面去 尝试了2种方式对数据进行迁移,一种是r ...

  4. nginx的安装及基本配置

    在CentOS7(mini)上安装: [root@~ localhost]#lftp 172.16.0.1 lftp 172.16.0.1:/pub/Sources/7.x86_64/nginx> ...

  5. ruby on rails 环境搭建步骤

    1.安装ruby ruby的下载页面一个版本有3样要下载的,帮助文件和安装文件.还有一个mingw. 安装时抛出make出错信息就是由于没有安装mingw引起的 到下载页http://rubyforg ...

  6. sql查询将列里面的值替换为别的值但是实际值不变

    数据库有一张表BUG(缺陷记录表) 里面有字段severity(严重程度): severity的值实际为1,2,3,4,但希望在查询结果中将severity的1,2,3,4值显示为其他的值,但seve ...

  7. Linux TCP通信例子

    TCP通信的C/S模型 ///server.c #include <sys/types.h> #include <sys/socket.h> #include <stdi ...

  8. /*带动画效果的hover*/

    <!DOCTYPE html> /*带动画效果的hover*/ <html lang="en"> <head> <meta charset ...

  9. Entity Framework Code-First(12):Configure One-to-Many

    Configure One-to-Many Relationship: Here, we will learn how to configure One-to-Many relationship be ...

  10. eos命令

    ps -ef|grep javakill -9 端口号cd /opt/sudytrue>nohup.outnohup eos7.5/startServer.sh &