Skip to content

Commit fe2d5e7

Browse files
committed
Create README - LeetHub
1 parent d478638 commit fe2d5e7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<h2><a href="https://leetcode.com/problems/find-the-closest-palindrome">564. Find the Closest Palindrome</a></h2><h3>Hard</h3><hr><p>Given a string <code>n</code> representing an integer, return <em>the closest integer (not including itself), which is a palindrome</em>. If there is a tie, return <em><strong>the smaller one</strong></em>.</p>
2+
3+
<p>The closest is defined as the absolute difference minimized between two integers.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> n = &quot;123&quot;
10+
<strong>Output:</strong> &quot;121&quot;
11+
</pre>
12+
13+
<p><strong class="example">Example 2:</strong></p>
14+
15+
<pre>
16+
<strong>Input:</strong> n = &quot;1&quot;
17+
<strong>Output:</strong> &quot;0&quot;
18+
<strong>Explanation:</strong> 0 and 2 are the closest palindromes but we return the smallest which is 0.
19+
</pre>
20+
21+
<p>&nbsp;</p>
22+
<p><strong>Constraints:</strong></p>
23+
24+
<ul>
25+
<li><code>1 &lt;= n.length &lt;= 18</code></li>
26+
<li><code>n</code> consists of only digits.</li>
27+
<li><code>n</code> does not have leading zeros.</li>
28+
<li><code>n</code> is representing an integer in the range <code>[1, 10<sup>18</sup> - 1]</code>.</li>
29+
</ul>

0 commit comments

Comments
 (0)