public class Solution {
public int reverse(int x) {
int ret=0;
while(x!=0)
{
int t=x%10;
ret=ret*10+t;
x=x/10;

}

return ret;

}
}

public class Solution {
public boolean isPalindrome(int x) {
if(x<0) return false;
if(x==0) return true;
int ret=0;
int xold=x;
while(x!=0)
{
int temp= x%10; // zui hou yi wei
ret=ret*10+temp; x=x/10; } if(ret==xold) return true;
return false; }
}

leetcode reverse integer&&Palindrome Number的更多相关文章

  1. Reverse Integer - Palindrome Number - 简单模拟

    第一个题目是将整数进行反转,这个题实现反转并不难,主要关键点在于如何进行溢出判断.溢出判断再上一篇字符串转整数中已有介绍,本题采用其中的第三种方法,将数字转为字符串,使用字符串比较大小的方法进行比较. ...

  2. leetcode bug & 9. Palindrome Number

    leetcode bug & 9. Palindrome Number bug shit bug "use strict"; /** * * @author xgqfrms ...

  3. [LeetCode 题解]:Palindrome Number

    前言   [LeetCode 题解]系列传送门:  http://www.cnblogs.com/double-win/category/573499.html   1.题目描述 Determine ...

  4. LeetCode(9) - Palindrome Number

    题目要求判断一个整数是不是回文数,假设输入是1234321,就返回true,输入的是123421,就返回false.题目要求in-place,思路其实很简单,在LeetCode(7)里面我们刚好做了r ...

  5. 【一天一道LeetCode】#9. Palindrome Number

    一天一道LeetCode系列 (一)题目 Determine whether an integer is a palindrome. Do this without extra space. Some ...

  6. leetcode题解 9. Palindrome Number

    9. Palindrome Number 题目: Determine whether an integer is a palindrome. Do this without extra space. ...

  7. 【LeetCode】9. Palindrome Number (2 solutions)

    Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. click t ...

  8. 《LeetBook》leetcode题解(9):Palindrome Number[E]——回文数字

    我现在在做一个叫<leetbook>的开源书项目,把解题思路都同步更新到github上了,需要的同学可以去看看 地址:https://github.com/hk029/leetcode 这 ...

  9. LeetCode Problem 9:Palindrome Number回文数

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

随机推荐

  1. 【转】JSON简介以及用法代码汇总

    什么是JSON? JavaScript 对象表示法(JavaScript Object Notation). JSON是一种轻量级的数据交换格式,某个JSON格式的文件内部譬如可以长成这样: { &q ...

  2. 使用css3实现文章新闻列表排行榜(数字)

    列举几个简单的文章排行榜数字效果 一:使用list-style来显示数字.圆点.字母或者图片 <style> li{width:300px; border-bottom: 1px dott ...

  3. a标签拨打电话、发短信、发邮件

    1.<a href=”tel:xxxx”>拨打电话</a> 2.<a href=”sms:xxxx”>发短信</a> 3.<a href=”mai ...

  4. 用开源软件构建App的高效服务端

    1.APP后端的重要性 2.架构目标与选型 3.Apache/Nginx? 4.为何选择Php 5.4? 5.Phalcon还是其它? 6.MySql 5.6 / MariaDB ? 7.Cobar: ...

  5. 贴板子系列_1-exgcd

    exgcd ll exgcd(ll a,ll b,ll &x,ll &y) { ) { x=;y=;return a; } ll r=exgcd(b,a%b,x,y); ll t=x; ...

  6. 一些嵌入式和FPGA相关模块的开源

    工作一年,整理下手头做过的东西,分享出来,希望能帮到大家. 嵌入式方面,主要集中在Xilinx家的器件上,ZYNQ居多.Linux相关的就不贴了,网上的资料太多,xilinx-wiki上资料都是比较全 ...

  7. ▲历史回眸--abbr和acronym的渊源

    网景和微软的浏览器之战早已淡去多年,最终以微软的IE浏览器胜出,特别是IE6的出现,一度成为世界浏览器的霸主,至今无人能敌.去年IE6荣获“终身成就奖”,真是实至名归.本文涉及的两个标签abbr和ac ...

  8. 从小白进阶ubuntu高手的必经之路—命令

    精选的十二个ubuntu下的命令,熟记于心,则能甩掉ubuntu小白标签,高手的伟岸形象焕然生发.一.管理员权限绝大部分情况下,命令的行为须要被赋予管理员权限才能执行.命令 sudo 作用:赋予当前命 ...

  9. Codeforces Round #321 div2

    好像前几场的题解忘记写了, Orz 状态太差, 平均出两题   都不好意思写了 , 连掉4场, 都要哭晕了. 很水的一场, 写完A B C就去睡了  D题其实不难, E题研究Ing(已用一种奇怪的姿势 ...

  10. C++的数据类型

    C++的数据类型 计算机处理的对象是数据,而数据是以某种特定的形式存在的(例如整数.浮点数.字符等形式). 不同的数据之间往往还存在某些联系(例如由若干个整数组成一个整数数组).数据结构指的是数据的组 ...