Class Solution

java.lang.Object
g0001_0100.s0009_palindrome_number.Solution

public class Solution extends Object
9 - Palindrome Number.<p>Easy</p> <p>Given an integer <code>x</code>, return <code>true</code> if <code>x</code> is palindrome integer.</p> <p>An integer is a <strong>palindrome</strong> when it reads the same backward as forward. For example, <code>121</code> is palindrome while <code>123</code> is not.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> x = 121</p> <p><strong>Output:</strong> true</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> x = -121</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong> From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> x = 10</p> <p><strong>Output:</strong> false</p> <p><strong>Explanation:</strong> Reads 01 from right to left. Therefore it is not a palindrome.</p> <p><strong>Example 4:</strong></p> <p><strong>Input:</strong> x = -101</p> <p><strong>Output:</strong> false</p> <p><strong>Constraints:</strong></p> <ul> <li><code>-2<sup>31</sup> <= x <= 2<sup>31</sup> - 1</code></li> </ul> <p><strong>Follow up:</strong> Could you solve it without converting the integer to a string?</p>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • isPalindrome

      public boolean isPalindrome(int x)