Description:

Given a 32-bit signed integer, reverse digits of an integer.

Example 1:

Input: 123 Output: 321

Example 2:

Input: -123 Output: -321

Example 3:

Input: 120 Output: 21

Note:
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.

Answer:

Review:

1、数据类型长度 参考:http://blog.sina.com.cn/s/blog_57421ff80100c7g1.html

2、C++ int32位溢出判断 参考:https://blog.csdn.net/hgpenglin/article/details/85008983 、https://blog.csdn.net/u012604810/article/details/80290706

 

posted on 2019-03-18 22:25  王晓阳的小可爱  阅读(118)  评论(0编辑  收藏  举报