mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
45 lines
1.3 KiB
HTML
45 lines
1.3 KiB
HTML
<p>返回所有长度为 <code>n</code> 且满足其每两个连续位上的数字之间的差的绝对值为 <code>k</code> 的<strong> 非负整数 </strong>。</p>
|
||
|
||
<p>请注意,<strong>除了 </strong>数字 <code>0</code> 本身之外,答案中的每个数字都 <strong>不能 </strong>有前导零。例如,<code>01</code> 有一个前导零,所以是无效的;但 <code>0</code> 是有效的。</p>
|
||
|
||
<p>你可以按 <strong>任何顺序</strong> 返回答案。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>n = 3, k = 7
|
||
<strong>输出:</strong>[181,292,707,818,929]
|
||
<strong>解释:</strong>注意,070 不是一个有效的数字,因为它有前导零。
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>n = 2, k = 1
|
||
<strong>输出:</strong>[10,12,21,23,32,34,43,45,54,56,65,67,76,78,87,89,98]</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>n = 2, k = 0
|
||
<strong>输出:</strong>[11,22,33,44,55,66,77,88,99]
|
||
</pre>
|
||
|
||
<p><strong>示例 4:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>n = 2, k = 2
|
||
<strong>输出:</strong>[13,20,24,31,35,42,46,53,57,64,68,75,79,86,97]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>2 <= n <= 9</code></li>
|
||
<li><code>0 <= k <= 9</code></li>
|
||
</ul>
|