判断一个数是否是回文数

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

 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. Tornado sqlalchemy

    上篇文章提到了,最近在用 Python 做一个网站.除了 Tornado ,主要还用到了 SQLAlchemy.这篇就是介绍我在使用 SQLAlchemy 的过程中,学到的一些知识. 首先说下,由于最 ...

  2. oracle中,拼接的字符串给游标赋值

    直接open cur from sql;即可. 例子: create or replace procedure test(tableName varchar2) is TYPE cur_type IS ...

  3. iOS UILabel根据字符串长度自动适应宽度和高度

    //这个frame是初设的,没关系,后面还会重新设置其size.     UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0, ...

  4. js函数调用模式

    1.函数调用 调用一个函数将暂停当前函数的执行,传递控制权和参数给新函数.除了函数声明时定义的形参,每个函数还接受两个附加的参数:this和arguments(arguments并不是一个真正的数组, ...

  5. Echarts动态加载后台数据

    注意:1.用Ajax请求获取后台数据 2.Echarts只能处理Json数据 后台Controller:根据业务需求不同而返回不同数据,我前台要循环遍历Echarts的series进行数据添加,所以后 ...

  6. 基本套接字编程(4) -- poll篇

    1. poll技术 poll函数起源于SVR3,最初局限于流设备.SVR4取消了这种限制,允许poll工作在任何描述符上.poll提供的功能与select类似,不过在处理流设备时,它能够提供额外的信息 ...

  7. C# 根据身份证号码获取简易信息

    public class PackIden { /// <summary> /// 根据身份证获取生日 /// </summary> /// <param name=&q ...

  8. 模板短信接口调用java,pythoy版(一) 网易云信

    说明 短信服务平台有很多,我只是个人需求,首次使用,算是测试用的,故选个网易(大公司). 稳定性:我只测试了15条短信... 不过前3条短信5分钟左右的延时,后面就比较快.... 我只是需要发短信,等 ...

  9. SQLSERVER执行性能统计工具SQLQueryStress

    SQLSERVER执行时间统计工具SQLQueryStress 有时候需要检测一下SQL语句的执行时间,相信大家都会用SET STATISTICS TIME ON开关打开SQLSERVER内置的时间统 ...

  10. 更改vsts源代码绑定服务器地址方法

    第一步找到更改源代码管理 第二步首先选中第一个,滚动条拉至最后一项,点击最后一项(全选). 第三步点击绑定,vsts会自动签出所有项目,而后签入就可以更改成功了.