mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-14 11:51:42 +08:00
add leetcode problem-cn part3
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<p>给定一个表示整数的字符串 <code>n</code> ,返回与它最近的回文整数(不包括自身)。如果不止一个,返回较小的那个。</p>
|
||||
|
||||
<p>“最近的”定义为两个整数<strong>差的绝对值</strong>最小。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> n = "123"
|
||||
<strong>输出:</strong> "121"
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong> n = "1"
|
||||
<strong>输出:</strong> "0"
|
||||
<strong>解释:</strong> 0 和 2是最近的回文,但我们返回最小的,也就是 0。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n.length <= 18</code></li>
|
||||
<li><code>n</code> 只由数字组成</li>
|
||||
<li><code>n</code> 不含前导 0</li>
|
||||
<li><code>n</code> 代表在 <code>[1, 10<sup>18</sup> - 1]</code> 范围内的整数</li>
|
||||
</ul>
|
Reference in New Issue
Block a user