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 ...
随机推荐
- 初学node.js-nodejs中实现用户注册路由
经过前面几次的学习,已经可以做下小功能,今天要实现的事用户注册路由. 一.users_model.js 功能:定义用户对象模型 var mongoose=require('mongoose'), S ...
- 【Linux开发】【Qt开发】QT 同时支持鼠标和触摸屏
QT 同时支持鼠标和触摸屏 现在 如果我要使用鼠标 导入环境变量 export QWS_MOUSE_PROTO=MouseMan:/dev/input/mice 使用触摸屏,导入环境变量 export ...
- 20191112 Spring Boot官方文档学习(4.4)
4.4.日志 Spring Boot使用Commons Logging进行所有内部日志记录,但是使底层日志实现打开状态.为Java Util Logging,Log4J2和Logback提供了默认配置 ...
- 红帽学习笔记[RHCSA] 第三课[输出重定向、Vi编辑器]
第三课 关于Linux的输入输出 输入输出 0 stdin 标准输入 仅读取 1 stdout 标准输出 仅写入 2 stderr 标准错误 仅写入 3 filename 其他文件 读取和/或写入 输 ...
- Kubernetes组件及网络基础
在前面的部分了解了Pod的创建删除 ,查看信息等.那么我们怎么去管理Pod呢?我们可以通过 ReplicationController 去管理维护 Pod. Replication Controlle ...
- 数位dp相关
经典的数位Dp是要求统计符合限制的数字的个数. 一般的形式是:求区间[n,m]满足限制f(1). f(2). f(3)等等的数字的数量是多少. 条件 f(i) 一般与数的大小无关,而与数的组成有关. ...
- Codeforces 1262E Arson In Berland Forest(二维前缀和+二维差分+二分)
题意是需要求最大的扩散时间,最后输出的是一开始的火源点,那么我们比较容易想到的是二分找最大值,但是我们在这满足这样的点的时候可以发现,在当前扩散时间k下,以这个点为中心的(2k+1)2的正方形块内必 ...
- 面向对象super 练习
看代码写结果[如果有错误,则标注错误即可,并且假设程序报错可以继续执行] class Foo(object): a1 = 1 def __init__(self,num): self.num = nu ...
- CSRF Failed: CSRF token missing or incorrect
Django设置本身没有关闭CSRF Django设置已经关闭CSRF,可能是由于两个项目都使用同一个端口,调试的时候就会出现Cookie里面csrftoken重用的问题,清理Cookie就好
- Oracle 查询 in条件个数大于1000的解决方案
Oracle 查询 in条件个数大于1000的解决方案,我所了解的有如下四种: 1. 把in分组再or: 思路:如果list的长度为2000,可以500个分一组,就有4个组,这4个组之间再or即可. ...