https://oj.leetcode.com/problems/palindrome-number/

判断是否为回文数

取每一位存到vector中,再判断

负数不是回文数

class Solution {
public:
bool isPalindrome(int x) {
vector<int> digit;
if(x<)
return false; while(x)
{
digit.push_back(x%);
x = x/;
} for(int i = ;i<digit.size()/;i++)
{
if(digit[i]!=digit[digit.size() - -i])
return false;
}
return true;
}
};

LeetCode OJ--Palindrome Number的更多相关文章

  1. LeetCode OJ Palindrome Number(回文数)

    class Solution { public: bool isPalindrome(int x) { ,init=x; ) return true; ) return false; ){ r=r*+ ...

  2. Leetcode练习题 Palindrome Number

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

  3. Leetcode 9. Palindrome Number(水)

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

  4. [LeetCode][Python]Palindrome Number

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

  5. leetcode 9 Palindrome Number 回文数

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

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

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

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

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

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

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

  9. [LeetCode] 9.Palindrome Number - Swift

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

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

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

随机推荐

  1. 3224: Tyvj 1728 普通平衡树(finger tree)

    3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 19122  Solved: 8359[Submit][St ...

  2. This application has request the Runtime to terminate it in an unusual way.

    Q: CertsMV.exe  gui popup two dialogs as follow. A: 测试发现是分配内存导致,频繁分配内存(大约6M) 可能是堆管理导致 分配大内存分配失败,程序未对 ...

  3. sql server备份

    完全备份 declare @device varchar(255),@path varchar(255),@dbname varchar(255)set @dbname='MIS_TEMP'set @ ...

  4. chrome浏览器设置自动切换代理上网的方法

    利用shadowsocks代理软件实现FQ时,如果都走代理模式,流量肯定不够.可以利用chrome的SwitchyOmega插件实现自动根据URL来决定是否使用代理.设置如下: 1.安装Switchy ...

  5. 查找jar包中.class文件关键字(变量名,字符串)

    有时查看日志,常常会发现由框架底层打印的错误日志.要修改这个错误的时候,如果不是对框架特别熟悉,就需要按照可能产生这个错误日志的流程一步一步找,一时半会不一定能找到.比如本人最近对smartfoxse ...

  6. iptables + Denyhost抵御暴力破解

    使用iptables 现在每分钟连接ssh的次数 #允许本地环回接口访问   1 iptables -A INPUT -i lo -j ACCEPT #对已经建立的所有链接都放行   1 iptabl ...

  7. CentOS7.3系统启动故障修复

    CentOS7.3系统启动故障修复 破解CentOS7的root口令方法一 启动时任意键暂停启动菜单,选择启动内核菜单项 按 e 键进入编辑模式 将光标移动 linux16 开始的行,添加内核参数rd ...

  8. jQuery动画的hover连续触发动画bug处理

    一.问题 为元素设置hover上实现动画的效果,当鼠标反复快速进入元素时,动画会在鼠标停止后依然执行,导致动画和鼠标的动作不一致. 二.解决方法 要解决这种问题,可以使用jquery的stop()方法 ...

  9. xtrabackup安装使用说明

    软件介绍: Percona XtraBackup是一块开源且免费的对MySQL Innodb存储引擎备份数据的工具,使用此工具的时候不需停止MySQL,而且支持压缩备份,支持对Innodb存储引擎做增 ...

  10. Python之面向对象:属性

    一.属性定义 1.类属性 类属性定义在类中且在函数体之外:类属性通常不作为实例属性使用:类变量紧接在类名后面定义 类属性的引用:类名.count eg:Employee.count 实例中可以引用类的 ...