1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/找到指定长度的回文数 [find-palindrome-with-fixed-length].html
2022-03-29 16:56:27 +08:00

37 lines
1.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个整数数组&nbsp;<code>queries</code>&nbsp;和一个 <strong></strong>&nbsp;整数&nbsp;<code>intLength</code>&nbsp;,请你返回一个数组&nbsp;<code>answer</code>&nbsp;,其中&nbsp;<code>answer[i]</code> 是长度为&nbsp;<code>intLength</code>&nbsp;&nbsp;<strong>正回文数</strong> 中第<em>&nbsp;</em><code>queries[i]</code>&nbsp;小的数字,如果不存在这样的回文数,则为 <code>-1</code>&nbsp;</p>
<p><strong>回文数</strong> 指的是从前往后和从后往前读一模一样的数字。回文数不能有前导 0 。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>queries = [1,2,3,4,5,90], intLength = 3
<b>输出:</b>[101,111,121,131,141,999]
<strong>解释:</strong>
长度为 3 的最小回文数依次是:
101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, ...
第 90 个长度为 3 的回文数是 999 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>queries = [2,4,6], intLength = 4
<b>输出:</b>[1111,1331,1551]
<strong>解释:</strong>
长度为 4 的前 6 个回文数是:
1001, 1111, 1221, 1331, 1441 和 1551 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= queries.length &lt;= 5 * 10<sup>4</sup></code></li>
<li><code>1 &lt;= queries[i] &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= intLength&nbsp;&lt;= 15</code></li>
</ul>