题目描述:

Determine whether an integer is a palindrome. Do this without extra space.

解题分析:

^_^个人觉得这道题没有什么可分析的,直接看代码就能明白^_^.

具体代码:

 public class Solution {
public static boolean isPalindrome(int x) {
if(x<0)
return false;
if(x>=0&x<=9)
return true;
int n=x;
int sum=0;
while(n!=0){
int num1=n%10;
int num2=n/10;
sum=sum*10+num1;
n=num2;
}
if(sum==x){
return true;
}
return false;
}
}

【leetcode】9. Palindrome Number的更多相关文章

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

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

  2. 【LeetCode】9. Palindrome Number 回文数

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 公众号:负雪明烛 本文关键词:回文数,回文,题解,Leetcode, 力扣,Python ...

  3. 【leetcode】 9. palindrome number

    @requires_authorization @author johnsondu @create_time 2015.7.13 9:48 @url [palindrome-number](https ...

  4. 【LeetCode】009. Palindrome Number

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

  5. 【LeetCode】9 Palindrome Number 回文数判定

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

  6. 【LeetCode】375. Guess Number Higher or Lower II 解题报告(Python)

    [LeetCode]375. Guess Number Higher or Lower II 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://f ...

  7. 【LeetCode】137. Single Number II 解题报告(Python)

    [LeetCode]137. Single Number II 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/problems/single- ...

  8. 【LeetCode】306. Additive Number 解题报告(Python)

    [LeetCode]306. Additive Number 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http: ...

  9. 【LeetCode】452. Minimum Number of Arrows to Burst Balloons 解题报告(Python)

    [LeetCode]452. Minimum Number of Arrows to Burst Balloons 解题报告(Python) 标签(空格分隔): LeetCode 题目地址:https ...

随机推荐

  1. C# 图片保存到数据库和从数据库读取图片并显示

    图片保存到数据库的方法: public void imgToDB(string sql)        {   //参数sql中要求保存的imge变量名称为@images            //调 ...

  2. [AngularJS] Lazy Loading modules with ui-router and ocLazyLoad

    We've looked at lazy loading with ocLazyLoad previously, but what if we are using ui-router and want ...

  3. iOS开发——语法篇OC篇&高级语法精讲二

    Objective高级语法精讲二 Objective-C是基于C语言加入了面向对象特性和消息转发机制的动态语言,这意味着它不仅需要一个编译器,还需要Runtime系统来动态创建类和对象,进行消息发送和 ...

  4. form表单中method的get和post区别

    一.问题的提出   <form action="getPostServlet/getPost.do?param4=param4" method="get" ...

  5. php 正则中文匹配

    汉字一定注意是gbk还是utf8编码 UTF-8匹配:在javascript中,要判定字符串是中文是很简朴的.比如:var str = "php编程";if (/^[\u4e00- ...

  6. c语言排序算法总结

    一.希尔(Shell)排序法 /* Shell 排序法 */ #include <stdio.h> void sort(int v[],int n) {      int gap,i,j, ...

  7. jquery 页面跳转 表单提交

    $("#button").click(function () {            $("#form").first().attr("action ...

  8. ZOJ 3122 Sudoku

    Sudoku Time Limit:10000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status ...

  9. saltstack实战3--配置管理之pillar

    数据系统-Pillar pillar和grains类似,但是它能给minion指定它想要的数据,安全性较好,另外它是在master端设置的   应用场景: grains的特性–每次启动汇报.静态决定了 ...

  10. SQL表连接查询

    SQL表连接查询(inner join.full join.left join.right join) 表的数据有: 一.内连接-inner jion : 最常见的连接查询可能是这样,查出学生的名字和 ...