You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2>9. Palindrome Number</h2><h3>Easy</h3><hr><div><p>Given an integer <code>x</code>, return <code>true</code> if <code>x</code> is palindrome integer.</p>
2
+
3
+
<p>An integer is a <strong>palindrome</strong> when it reads the same backward as forward.</p>
4
+
5
+
<ul>
6
+
<li>For example, <code>121</code> is a palindrome while <code>123</code> is not.</li>
7
+
</ul>
8
+
9
+
<p> </p>
10
+
<p><strong>Example 1:</strong></p>
11
+
12
+
<pre><strong>Input:</strong> x = 121
13
+
<strong>Output:</strong> true
14
+
<strong>Explanation:</strong> 121 reads as 121 from left to right and from right to left.
15
+
</pre>
16
+
17
+
<p><strong>Example 2:</strong></p>
18
+
19
+
<pre><strong>Input:</strong> x = -121
20
+
<strong>Output:</strong> false
21
+
<strong>Explanation:</strong> From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
22
+
</pre>
23
+
24
+
<p><strong>Example 3:</strong></p>
25
+
26
+
<pre><strong>Input:</strong> x = 10
27
+
<strong>Output:</strong> false
28
+
<strong>Explanation:</strong> Reads 01 from right to left. Therefore it is not a palindrome.
29
+
</pre>
30
+
31
+
<p> </p>
32
+
<p><strong>Constraints:</strong></p>
33
+
34
+
<ul>
35
+
<li><code>-2<sup>31</sup> <= x <= 2<sup>31</sup> - 1</code></li>
36
+
</ul>
37
+
38
+
<p> </p>
39
+
<strong>Follow up:</strong> Could you solve it without converting the integer to a string?</div>
0 commit comments