LeetCode 9. Palindrome Number

Description

https://leetcode.com/problems/palindrome-number/

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

Explanation

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.

Tutorial

Java Solution

Leave a Reply

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