判断一个数是否是回文数

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

 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. PHP 判断是否为Get/Post/Ajax提交

    <?php PHP 判断是否为Get/Post/Ajax提交 /** * 是否是AJAx提交的 * @return bool */ function isAjax(){ if(isset($_S ...

  2. display 显示隐藏 ESAYuI

    $("#rejectCauseDisplay").css('display',"block");     $("#rejectCauseDisplay ...

  3. Scrum会议(Beta版本)

    组名:天天向上 组长:王森 组员:张政.张金生.林莉.胡丽娜 代码地址:HTTPS:https://git.coding.net/jx8zjs/llk.git SSH:git@git.coding.n ...

  4. Servlet实现重定向的两种方式

    使用Servlet实现请求重定向:两种方式 1. response.setStatus(302); response.setHeader("location", "/Re ...

  5. POJ 2983 Is the Information Reliable? 差分约束

    裸差分约束. //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #i ...

  6. 用PHP实现URL转换短网址的算法示例

    短网址就是把一个长的地址转换在超级短的网址,然后访问短网址即可跳转到长网址了,下面来看用PHP实现URL转换短网址的算法与例子. 短网址(Short URL) ,顾名思义就是在形式上比较短的网址.在W ...

  7. 由struts错误使用引发的漏洞,使用参数作为返回的文件路径或文件名,作为返回result 值

    该错误可以导致他人任意访问该路径下的任何文件. struts 文件 <?xml version="1.0" encoding="UTF-8" ?> ...

  8. kenrnel 驱动中常用的宏

    http://blog.csdn.net/uruita/article/details/7263290 1. MODULE_DEVICE_TABLE (usb, skel_table);该宏生成一个名 ...

  9. 利用破解dll来获取到一个软件的注册码

    ---恢复内容开始--- 首先做这个事是纯属于个人研究而已,请勿以侵犯他人劳动成果. 今天看到了一个关于IL语句的文章,于是就学学,然后实践实践下.废话不多说了. 1.安装好某一个需要注册才可以的使用 ...

  10. String的两种生成方式

    String的两种生成方式 第一种是双引号法,效率更高 java为String类提供了缓冲池机制,当使用双引号定义对象时,java环境首先去字符串缓冲池寻找相同内容的字符串,如果存在就直接拿出来应用, ...