Skip to content

Commit ebabe82

Browse files
committed
Create README - LeetHub
1 parent 9d0a5ea commit ebabe82

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2><a href="https://leetcode.com/problems/find-the-closest-palindrome/">564. Find the Closest Palindrome</a></h2><h3>Hard</h3><hr><div><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><strong>Input:</strong> n = "123"
9+
<strong>Output:</strong> "121"
10+
</pre>
11+
12+
<p><strong class="example">Example 2:</strong></p>
13+
14+
<pre><strong>Input:</strong> n = "1"
15+
<strong>Output:</strong> "0"
16+
<strong>Explanation:</strong> 0 and 2 are the closest palindromes but we return the smallest which is 0.
17+
</pre>
18+
19+
<p>&nbsp;</p>
20+
<p><strong>Constraints:</strong></p>
21+
22+
<ul>
23+
<li><code>1 &lt;= n.length &lt;= 18</code></li>
24+
<li><code>n</code> consists of only digits.</li>
25+
<li><code>n</code> does not have leading zeros.</li>
26+
<li><code>n</code> is representing an integer in the range <code>[1, 10<sup>18</sup> - 1]</code>.</li>
27+
</ul>
28+
</div>

0 commit comments

Comments
 (0)