0

Bitwise operator in reverse of an integer 123 to 321

If(result>integer.max_value/10 || result== integer.max_value/10 && A >7) return 0; Plz , can anyone help me with this? You see this code and method in this below YouTube link https://youtu.be/CRgXG1vK-wg

21st Sep 2020, 2:21 PM
Manivee
5 Respuestas
0
That's all doing reverse of an Integer.. If the resulted values going exceed the Integer range then it just returning 0. result >= Integer.max_value/10 is there to check that just in next adding reminder will produce incorrect overflow result..
21st Sep 2020, 9:34 PM
Jayakrishna 🇮🇳
0
|| result== integer.max_value/10 && A >7) return 0;
22nd Sep 2020, 5:25 AM
Manivee
0
Then what is the use of this
22nd Sep 2020, 5:25 AM
Manivee
0
Integer Max value is 2147483647 and min value is -2147483648 So here look, last digit is 7,more than 7 and already result>=Integer.max_value/10 true then it cause overflow similar for next condition for - 8, min value. I combined > and = to >=. There are actually redundant checks..
22nd Sep 2020, 6:23 PM
Jayakrishna 🇮🇳
0
Ok thq
23rd Sep 2020, 8:12 AM
Manivee