题目: 思路: 先把变量定义为long型用于处理溢出问题最大整型int.MaxValue,最小整型int.MinValue 代码: public class Solution { public int Reverse(int x) { long res=0; while(x!=0) { res=res*10+x%10; x=x/10; } if(res>int.MaxValue||res<int.MinValue) { return 0; } return (int)res; } } 补充: