判断一个数是否是回文数

方法是将数回转,看回转的数和原数是否相同

 class Solution {
public:
bool isPalindrome(int x) {
if(x < ) return false;
int _x = ;
int n = x;
for(; x; x/= ){
_x = _x * + x%;
}
return n == _x;
}
};

Leetcode 9 Palindrome Number 数论的更多相关文章

  1. Leetcode练习题 Palindrome Number

    9. Palindrome Number Question: Determine whether an integer is a palindrome. An integer is a palindr ...

  2. Leetcode 9. Palindrome Number(水)

    9. Palindrome Number Easy Determine whether an integer is a palindrome. An integer is a palindrome w ...

  3. leetcode 9 Palindrome Number 回文数

    Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...

  4. LeetCode 9. Palindrome Number (回文数字)

    Determine whether an integer is a palindrome. Do this without extra space. 题目标签:Math 题目给了我们一个int x, ...

  5. Leetcode 9. Palindrome Number(判断回文数字)

    Determine whether an integer is a palindrome. Do this without extra space.(不要使用额外的空间) Some hints: Co ...

  6. [LeetCode][Python]Palindrome Number

    # -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/palindr ...

  7. 蜗牛慢慢爬 LeetCode 9. Palindrome Number [Difficulty: Easy]

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

  8. [LeetCode] 9.Palindrome Number - Swift

    Determine whether an integer is a palindrome. Do this without extra space. 题目意思:判断一个整数是否是回文数 例如:1232 ...

  9. [LeetCode] 9. Palindrome Number 验证回文数字

    Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...

随机推荐

  1. 問題排查:F5啟動偵錯後所提示的錯誤 (2)

    原始專案版本:Visual Studio 2005 開發環境:Visual Studio 2013 偵錯運行環境:IIS Express 啟動偵錯後,錯誤提示內容如下: HTTP 错误 403.14 ...

  2. jquery attr()方法 添加,修改,获取对象的属性值。

    jquery attr()方法 添加,修改,获取对象的属性值. jquery中用attr()方法来获取和设置元素属性,attr是attribute(属性)的缩写,在jQuery DOM操作中会经常用到 ...

  3. ADB 常用命令总结(持续更新)

    1.adb devices 2.抓取adb log:adb logcat -v time >test.log  (Log直接保存在个人电脑用户名下) 3.adb install 包地址(可以直接 ...

  4. maven 配置篇 之pom

    maven 配置篇 之pom.xml(一) 博客分类:  pm mavenXML配置管理项目管理junit      说完了settings.xml配置,下来说一下maven2的主要配置pom.xml ...

  5. [VBS]关机恶作剧

    一.关于脚本 1)本文中的脚本完成以下功能: 随机生成3道二位数加法题,如果答题错误则在60秒后关机. 如果全答对了,也会在60后关机,但脚本会提示解除定时关机的办法 2)在脚本运行过程中,退出本脚本 ...

  6. 多重背包 (poj 1014)

    题目:Dividing 题意:6种重量的的石头,每个给定数量,用总重的一半去装,问能否装满. #include <iostream> #include <algorithm> ...

  7. 添加ModelGoon插件Eclipse自动生成UML图

    下载ModelGoonjar包 http://download.csdn.net/detail/u011070297/8366021 下载完该jar之后,直接拷贝到Eclipse安装目录下的dropi ...

  8. delphi 十进制十六进制转换

    delphi有提供十进制转换成十六进制的函数: IntToStr();   返回值为String // 十进制转十六进制 var i: integer; str: string; begin i := ...

  9. Linux挂载磁盘

    查看 fdisk –l 挂载 mount 磁盘 目录 参考地址:http://blog.csdn.net/tianlesoftware/article/details/5642883 卸载 umoun ...

  10. iPad上的Cookie到底有多长?

    [故事背景]: 公司某个站点,特别依赖Cookie的使用,而且用的比较狠.在设计之初想当然地以为到达Cookie上限是猴年马月的事儿,没想到时过境迁,这个上限真的来了. 着手改吧,也不想投入太多.于是 ...