#
#
# @param x int整型
# @return int整型
# 利用切片法反转字符串,最后做出判断
class Solution:
def reverse(self , x ):
# write code here
x = str(x)
if x[0] == '-':
a = int('-' + x[1:][::-1])
else:
a = int(x[::-1])
return a if -2147483648 < a < 2147483647 else 0
京公网安备 11010502036488号