009.Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.
It turns out that there is no need to prevent overflow when reversing the integer. Palindrome of X will result in a negative number because of overflow, and that makes it never equals to the input number x
1 | public class Solution { |
A solution that prevents overflow.
1 | public class Solution { |