判断一个数是否是回文数

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

 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. HTML、CSS小知识--兼容IE的下拉选择框select

    HTML <div class="s_h_ie"> <select id="Select1" disabled="disabled& ...

  2. C# 程序间通信的各种途径及解析

    一.开篇 程序间通信的主要目的是实现多台计算机(也可以是同一台)中应用程序之间的数据共享与信息交换.在不同的计算机系统中,它们之间要通过网络之间的协议才能 实现数据共享与信息交换:在同一台计算机系统中 ...

  3. Log4j基本用法

    基本使用方法: Log4j由三个重要的组件构成:日志信息的优先级,日志信息的输出目的地,日志信息的输出格式.日志信息的优先级从高到低有ERROR.WARN.INFO.DEBUG,分别用来指定这条日志信 ...

  4. Base64编码通过URL传值的问题

    base64 编码中使用了 +号,+号通过URL传递时会变成空格,因为编码的方式的问题前台使用:Ext.encode(title_text.getValue().replace(/\+/g, '%2B ...

  5. iOS 支付宝支付

    在开发过程中,经常需要接入第三方支付.下面对支付进行一个概括. 支付宝支付 支付宝SDK下载地址:https://doc.open.alipay.com/doc2/detail?treeId=54&a ...

  6. c#控制IE浏览器自动点击等事件WebBrowser,mshtml.IHTMLDocument2 .

    // c#控制IE浏览器自动点击等事件WebBrowser,mshtml.IHTMLDocument2 分类: c# 2013-02-06 15:18 3008人阅读 评论(0) 收藏 举报 可以实现 ...

  7. WebBrowser 中遍历所有的frames

    枚举所有iframe的IWebBrowser2 // Get the IDispatch of the document. // LPDISPATCH lpDisp = NULL; lpDisp = ...

  8. Apache+PHP配置运行环境(getenv的使用)

    在开发与上线等多个环境下,常量的配置一般不同,例如开发环境和生产环境的一些域名肯定不一样,为了保证代码上线就能运行,要求在代码运行开始的时候对不同的环境区分这些常规变量. 找到Apache目录下虚拟主 ...

  9. Jade之Case

    Case jade中的case类似js中的switch语句. 当前一个when中无语句的时候,将一直往下直至遇到一个有语句的when才跳出. jade: - var friends = 10 case ...

  10. Ajax跨域请求ashx文件与Webservice文件

    前台页面: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1 ...