publicclassSolution{publicintReverse(int x){long K =0;while(x !=0){int M = x %10;
K = K *10+ M;
x = x /10;}if(K >int.MaxValue || K<int.MinValue){
K =0;}return(int)K;}}
题目:给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转思路:我们可以先算反转的数,让他转换成大于int类型的,最后比较,如果大于或者小于就返回0.public class Solution { public int Reverse(int x) { long K = 0; while (x != 0) ...