mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 16:01:41 +08:00
update
This commit is contained in:
42
leetcode/problem/palindrome-number.html
Normal file
42
leetcode/problem/palindrome-number.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<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.</p>
|
||||
|
||||
<ul>
|
||||
<li>For example, <code>121</code> is a palindrome while <code>123</code> is not.</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> x = 121
|
||||
<strong>Output:</strong> true
|
||||
<strong>Explanation:</strong> 121 reads as 121 from left to right and from right to left.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> x = -121
|
||||
<strong>Output:</strong> false
|
||||
<strong>Explanation:</strong> From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> x = 10
|
||||
<strong>Output:</strong> false
|
||||
<strong>Explanation:</strong> Reads 01 from right to left. Therefore it is not a palindrome.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>-2<sup>31</sup> <= x <= 2<sup>31</sup> - 1</code></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<strong>Follow up:</strong> Could you solve it without converting the integer to a string?
|
Reference in New Issue
Block a user