LeetCode题解——9Palindrome Number
2015-07-11 13:21
288 查看
Determine whether an integer is a palindrome. Do this without extra space.
class Solution { public: bool isPalindrome(int x) { if(x<0||(x!=0&&x%10==0)) return false; int y=0; while(x>y) { y = y*10 + x%10 ; x/=10; } return (y==x|| y/10==x); } };
相关文章推荐
- openStack动态迁移
- 经常使用vi编辑命令
- sqlserver使用户只能在某个架构下建立表和存储过程
- Nginx写IO占用高故障处理
- GSM tutorial
- Sqlmap渗透测试是常用语句
- 广播、多播、UNIX套接域
- Spring学习(23)--- AOP之Introductions应用
- 使用NPOI对Excel单元格增加下拉选框
- Android布局优化总结
- 自定义Log4cpp的日志输出格式
- 函数书写的一点总结
- LeetCode题解——8 String to Integer (atoi)
- 源码剖析之sun.misc.Unsafe
- Java面试题全集(下)
- Cacti安装详细步骤
- Spring配置文件元素<context:property-placeholder location="classpath:application.properties" />
- SDH指针
- WPF 下两种图片合成或加水印的方式
- MVC3学习笔记杂谈