leetcode 7-> Reverse Integer(32-bit signed integer)
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
p=abs(x)
rev=int(str(p)[::-])
if(x<):
if((-rev)<pow(-,)):
return
else:
return -(rev)
else:
if(rev>(pow(,)-)):
return
else:
return rev
leetcode 7-> Reverse Integer(32-bit signed integer)的更多相关文章
- K - Large Division 判断a是否是b的倍数。 a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer). 思路:取余;
/** 题目:K - Large Division 链接:https://vjudge.net/contest/154246#problem/K 题意:判断a是否是b的倍数. a (-10^200 ≤ ...
- 【LeetCode】Reverse Integer(整数反转)
这道题是LeetCode里的第7道题. 题目描述: 给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转. 示例 1: 输入: 123 输出: 321 示例 2: 输入: -123 ...
- LeetCode 7. Reverse Integer (JS)
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Examp ...
- LeetCode 7. Reverse Integer (倒转数字)
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Examp ...
- [LeetCode] 7. Reverse Integer 翻转整数
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Examp ...
- LeetCode 7. Reverse Integer(c语言版)
题目: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123Output: 321 Ex ...
- [leetcode]7. Reverse Integer反转整数
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Examp ...
- 蜗牛慢慢爬 LeetCode 7. Reverse Integer [Difficulty: Easy]
题目 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have ...
- LeetCode 7. Reverse Integer 一个整数倒叙输出
潜在问题:(1)随着求和可能精度会溢出int 范围,需要使用long 来辅助判断是否溢出,此时返回 0 Assume we are dealing with an environment which ...
- [LeetCode] 7. Reverse Integer ☆
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have y ...
随机推荐
- <转>jmeter(二)录制脚本
本博客转载自:http://www.cnblogs.com/imyalost/category/846346.html 个人感觉不错,对jmeter讲解非常详细,担心以后找不到了,所以转发出来,留着慢 ...
- The Little Prince-11/30
The Little Prince-11/30 Today, I have a meeting in our department. I sincerely hope that all of my d ...
- MXNet官方文档中文版教程(3):神经网络图(Symbol)
https://blog.csdn.net/qq_36165459/article/details/78394259 文档英文原版参见Symbol - Neural network graphs an ...
- JAVA连接数据库 #03# HikariCP
索引 为什么用数据库连接池? HikariCP快速入门 依赖 简单的草稿程序 设置连接池参数(只列举常用的) MySQL配置 修改Java连接数据库#02#中的代码 测试 为什么用数据库连接池? 为什 ...
- sitemap index
https://docs.djangoproject.com/en/2.1/ref/contrib/sitemaps/ very good
- K8S学习笔记之二进制的方式创建一个Kubernetes集群
0x00 单节点搭建和简述 minikube Minikube是一个工具,可以在本地快速运行一个单点的Kubernetes,尝试Kubernetes或日常开发的用户使用.不能用于生产环境. 官方地址: ...
- MySQL半同步安装以及参数
MySQL半同步安装以及参数 基于MySQL5.5 官档地址: Semisynchronous Replication Administrative Interface https://dev.mys ...
- Mysql 按天自动分区,合并老分区
适用于每天一个分区...不断加分区,导致分区不够用的情况 CREATE DEFINER=hehe@XXXXXX PROCEDURE p_auto_partition_day(IN databaseNa ...
- ora-24550 signo=6 signo=11解决
我们有台测试服务器pro*c/oci应用总是发生各种比较奇葩的现象,就这一台机器会发生,其他几十台都不会发生. sig 11的原因,内存地址访问越界.各signo的si_code含义可参考http:/ ...
- Kali linux 2018安装后全屏乱码解决
安装的时候选择了中文, 后来安装成功后成了全部乱码的. 原因是,系统没有中文字体显示安装包, 下载一个 sudo apt-get install ttf-wqy-zenhei 重启解决!