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. 服务器常说的U是什么意思?

    U是英文单词:unit 所说的1U和2U,是服务器的厚度,1U大概是相当于机柜的两个小格子,2U是四个格子.1U大概是4.45厘米(1U=1.75英寸,1英寸=2.54CM).以下这个是图片:

  2. Diycode开源项目 NodeListFragment分析

    1.整体分析 1.1.作用讲解 这个类没有用到,只是一个备用的. 分类列表,用于定制首页内容 考虑到节点列表一般不会变化,所以直接将数据封装在客户端中,可以直接查看,提高效率. 1.2.整体分析 首先 ...

  3. mysql不能登陆

    前些天还正常运行的mysql,不知怎么就不能登陆了.错误提示为 :ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (1 ...

  4. SPFA - Luogu 3385 【模板】负环

    [模板]负环 描述 找负环 输入 第一行一个正整数T表示数据组数,对于每组数据: 第一行两个正整数N M,表示图有N个顶点,M条边 接下来M行,每行三个整数a b w,表示a->b有一条权值为w ...

  5. Asp.net自定义控件开发任我行(3)-Render

    摘要 上一篇我们讲到了自定义标签TagPrefix用法,此篇我们来讲一下控件的呈现,主要是呈现下拉框 内容 呈现的方法有,Render,RenderControl,RenderChildren,这三个 ...

  6. HighCharts实现双Y轴

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.c ...

  7. 2017腾讯Web前端实习生招聘笔试题总结

    指针与引用的区别 考察margin塌陷 考察C++继承和~符号 考察TCP通讯过程 位码 三次握手 为什么不是两次握手 为什么不是四次握手 四次挥手 为什么要四次握手 TCP的状态 考察严格模式 进程 ...

  8. 隐匿攻击-ICMP

    ICMP隐蔽隧道从入门到精通 概述 众所周知传统socket隧道已极少,tcp.upd大量被防御系统拦截,dns.icmp.http/https等难于禁止的协议(当然还有各种xx over dns/i ...

  9. Python Flask构建可拓展的RESTful API

    1-1 Flask VS Django 1-2  课程更新维护说明: 1-3 环境.开发环境与Flask: 1.3.1 关注版本更新说明: 1-4 初始化项目:

  10. sklearn快速入门

    原创博文,转载请注明出处. (为了节约空间,打印结果常用"..."表示省略) 一.加载数据集 1. 加载sklearn自带的数据集 scikit-learn有一些自带的标准数据集, ...