LeetCode 9. Palindrome Number



Determine whether an integer is a palindrome. Do this without extra space.


The solution to the problem is very straightforward.

We can exclude non-palindrome numbers first.

  • Negative numbers are not palindrome numbers, e.g., -121.
  • Positive numbers end with 0 are not palindrome numbers, e.g., 120.

Then by comparing the integer number and its reversed integer, we can determine whether the integer is a palindrome.


Java Solution

Leave a Reply

Your email address will not be published. Required fields are marked *