Leetcode 9. Palindrome Number(水)
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
Example 3:
Input: 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome. 题解:计算倒过来的数是多少,判断两个数是否相等就行
class Solution {
public:
bool isPalindrome(int x) {
if(x < ) return false;
long long lx = ,rx = x;
while(rx > ){
lx = lx*+rx%;
rx /= ;
}
if(lx==x) return true;
else return false;
}
};
Leetcode 9. Palindrome Number(水)的更多相关文章
- Leetcode练习题 Palindrome Number
9. Palindrome Number Question: Determine whether an integer is a palindrome. An integer is a palindr ...
- leetcode 9 Palindrome Number 回文数
Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. S ...
- LeetCode 9. Palindrome Number (回文数字)
Determine whether an integer is a palindrome. Do this without extra space. 题目标签:Math 题目给了我们一个int x, ...
- Leetcode 9. Palindrome Number(判断回文数字)
Determine whether an integer is a palindrome. Do this without extra space.(不要使用额外的空间) Some hints: Co ...
- [LeetCode][Python]Palindrome Number
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/palindr ...
- 蜗牛慢慢爬 LeetCode 9. Palindrome Number [Difficulty: Easy]
题目 Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could nega ...
- [LeetCode] 9.Palindrome Number - Swift
Determine whether an integer is a palindrome. Do this without extra space. 题目意思:判断一个整数是否是回文数 例如:1232 ...
- [LeetCode] 9. Palindrome Number 验证回文数字
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same back ...
- 【leetcode】Palindrome Number
题目简述: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could n ...
随机推荐
- SpringBoot配置属性之Server参数
server配置server.address指定server绑定的地址 server.compression.enabled是否开启压缩,默认为false. server.compression.ex ...
- java版微信支付/查询/撤销
最近公司接入微信刷卡支付,网上根本没见到很直接的教程(可能眼拙),一直摸滚打爬,加班加点才走通,忍不了必须写一写 微信 刷卡支付/查询/撤销... 必须要有公众号然后去申请,申请自己去看文档,这里主要 ...
- CentOS7 NAT配置
环境说明:Cloud1中的GE0/0/1.GE0/0/3.GE0/0/5接口,分别与Centos7中的eth1.eth2.eth3接口桥接到同一虚拟网卡,R1,R2,R3均配置一条静态默认路由指向Ce ...
- 万万没想到,Spring Boot 竟然这么耗内存!
Spring Boot总体来说,搭建还是比较容易的,特别是Spring Cloud全家桶,简称亲民微服务. 但在发展趋势中,容器化技术已经成熟,面对巨耗内存的Spring Boot,小公司表示用不起. ...
- c++多线程并发学习笔记(0)
多进程并发:将应用程序分为多个独立的进程,它们在同一时刻运行.如图所示,独立的进程可以通过进程间常规的通信渠道传递讯息(信号.套接字..文件.管道等等). 优点:1.操作系统在进程间提供附附加的保护操 ...
- 1、Java语言概述与开发环境——JDK的安装与环境变量的配置
Selenium.Appium.Macaca.RobotFramework.Jmeter等框架或工具均必须的一样东西——JDK,也就是基于java开发的东西都要这个东西.JDK的概念在这里不作描述. ...
- css3实现颤动的动画
需求 页面要做一个活动入口,不能太显眼,但是又要用户能一眼就看出来. 演示 https://jsfiddle.net/vtsxc18q/ 实现 (部分动画代码) @keyframes chanDong ...
- P4556 [Vani有约会]雨天的尾巴(线段树合并+lca)
P4556 [Vani有约会]雨天的尾巴 每个操作拆成4个进行树上差分,动态开点线段树维护每个点的操作. 离线处理完向上合并就好了 luogu倍增lca被卡了5分.....于是用rmq维护.... 常 ...
- vue中项目如何引入sass (vue-cli项目)
1.进入项目目录 2.安装sass的依赖 npm install --save-dev sass-loader npm install --save-dev node-sass 3.在build文件夹 ...
- 关于Windows 10上MarkdownPad2无法预览的解决办法
升级win10后,发现一直可以用的MarkdownPad2预览功能不可以用了.于是在网上搜索了一下,刚开始没有解决.不过现在可以了.现在把解决方案记录下来.Windows10上使用MarkdownPa ...