Medium Problems
7. Reverse Integer
Solutions
Pop and Push digits & Check before Overflow
However, the statement can cause overflow. How can we check overflow beforehand? Assuming rev
is positive, then:
- If causes overflow, then it must be that
- If , then is guaranteed to overflow.
- If , then will overflow if and only if
Implementation
Last Update: 11:43 - 16 April 2024
Math