[Leetcode]009.Palindrome Number
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的更多相关文章
- 【JAVA、C++】LeetCode 009 Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. 解题思路一: 双指针法,逐位判断 Java代码如下 ...
- No.009 Palindrome Number
9. Palindrome Number Total Accepted: 136330 Total Submissions: 418995 Difficulty: Easy Determine whe ...
- LeetCode--No.009 Palindrome Number
9. Palindrome Number Total Accepted: 136330 Total Submissions: 418995 Difficulty: Easy Determine whe ...
- Leetcode练习题 Palindrome Number
9. Palindrome Number Question: Determine whether an integer is a palindrome. An integer is a palindr ...
- Leetcode 9. Palindrome Number(水)
9. Palindrome Number Easy Determine whether an integer is a palindrome. An integer is a palindrome w ...
- 【LeetCode】009. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negativ ...
- leetcode 9 Palindrome Number 回文数
Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...
- LeetCode 9. Palindrome Number (回文数字)
Determine whether an integer is a palindrome. Do this without extra space. 题目标签:Math 题目给了我们一个int x, ...
- Leetcode 9. Palindrome Number(判断回文数字)
Determine whether an integer is a palindrome. Do this without extra space.(不要使用额外的空间) Some hints: Co ...
随机推荐
- GridView有用的小方法--2017年2月13日
原文:http://blog.csdn.net/21aspnet/article/category/285354更多:http://blog.csdn.net/21aspnet/article/cat ...
- 51nod 1686 第K大区间 二分瞎搞
题目: 定义一个区间的值为其众数出现的次数. 现给出n个数,求将所有区间的值排序后,第K大的值为多少. 题解: 答案明显单调,我们考虑二分答案. 转化为判定问题后我们需要观察到一个性质: 如果一个区间 ...
- Linux CentOS安装Azure Cli工具
vim /etc/yum.repos.d/epel.repo [epel] name=epel baseurl=http://mirrors.sohu.com/fedora-epel/6/$basea ...
- JVM插庄之二:Java agent基础原理
javaagent 简介 Javaagent 只要作用在class被加载之前对其加载,插入我们需要添加的字节码. Javaagent面向的是我们java程序员,而且agent都是用java编写的,不需 ...
- VIsual Studio 2010 常用快捷键
1.Ctrl+S 保存 2.Ctrl+F: 查找 3.Ctrl+H: 替换 4.Ctrl+E,S: 查看空白 5.Ctrl+K+C: 注释选定内容 6.Ctrl+K+U: 取消选定注释内容 7.C ...
- Spring开发环境搭建
----------------siwuxie095 Spring 是运行在 Java 环境下的开发框架,因此在开发前需要 准备以下相关软件: JDK 7 或者以上版本 Eclipse 4 或以上版本 ...
- Add lombok to IntelliJ IDEA
Lombok study link: https://www.jianshu.com/p/365ea41b3573 Add below dependency code to pom.xml <d ...
- 获取剪切板上DataFormats.Dib格式的文件
if (formats.Contains(System.Windows.Forms.DataFormats.Dib)) { using (var img = System.Windows.Forms. ...
- Entity Framework Code-First(9.3):DataAnnotations - ConcurrencyCheck Attribute
ConcurrencyCheck Attribute: ConcurrencyCheck attribute can be applied to a property of a domain clas ...
- jQuery学习2
1,jQuery中的$有什么意义. $是 JQuery 常用的一个回传函数. 很多人写jquery代码是这样开始的 $(function(){ // do something }); 事实上它是jqu ...