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. webpack打包APP的后端地址处理

    PC端我们用webpack打包,只需要写相对路径,发布的时候和后端接口在同一目录下即可. 但是做过APP或者混合开发的同学都知道,APP不需要发布的,如果后端地址还是用相对路径的话,可想而知,调用后端 ...

  2. Apache+OpenSSL实现证书服务器提供HTTPS

    通过 Linux+Apache+OpenSSL 实现 SSL ( Secure Socket Layer )证书服务器,提供安全的 HTTPS ( Hypertext Transfer Protoco ...

  3. Excel对重复数据分组,求出不同的数据(office 2013)

    第一步: 第二步: 第三步:

  4. 基于ftp服务实现yum网络共享

    安装ftp服务:yum install vsftpd 安装后: CentOS7 启动服务:systemctl start vsftpd 设置开机启动:systemctl enable vsftpd 同 ...

  5. Python模块-requests(二)

    会话对象 会话对象能够跨请求保持某些参数. 它也会在同一个 Session 实例发出的所有请求之间保持 cookie, 期间使用 urllib3 的 connection pooling 功能. 所以 ...

  6. javascript基础之回调函数

    简单来说,回调函数:也就是将要执行的函数. 回调函数具体的定义为:函数A作为参数(函数引用)传递到另一个函数B中,并且这个函数B执行函数A.我们就说函数A叫做回调函数.如果没有名称(函数表达式),就叫 ...

  7. numpy.mean和numpy.random.multivariate_normal(依据均值和协方差生成数据,提醒:计算协方差别忘了转置)

    >> import numpy as np >>> A1_mean = [1, 1] >>> A1_cov = [[2, .99], [1, 1]]&g ...

  8. 2017 world final

    E 解题关键:二分时注意C函数的单调性. #include<bits/stdc++.h> #define eps 1e-8 #define INF 0x3f3f3f3f using nam ...

  9. koa1创建项目

    1.一定要全局安装(koa1.2和koa2都己经支持)npm install koa-generator -g 2.koa1.2 生成一个test项目,切到test目录并下载依赖 koa testcd ...

  10. Material使用07 MdGridListModule的使用

    1 MatGridListModule简介 对相似数据的展现,尤其是像是图片的展示 使用起来很像表格 官方文档:点击前往 2 MatGridListModule提供的指令 2.1 mat-grid-l ...