mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
27 lines
665 B
HTML
27 lines
665 B
HTML
|
<p>给定整数 <code>n</code> 和 <code>k</code>,返回 <code>[1, n]</code> 中字典序第 <code>k</code> 小的数字。</p>
|
||
|
|
||
|
<p> </p>
|
||
|
|
||
|
<p><strong>示例 1:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>输入: </strong>n = 13, k = 2
|
||
|
<strong>输出: </strong>10
|
||
|
<strong>解释: </strong>字典序的排列是 [1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9],所以第二小的数字是 10。
|
||
|
</pre>
|
||
|
|
||
|
<p><strong>示例 2:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>输入:</strong> n = 1, k = 1
|
||
|
<strong>输出:</strong> 1
|
||
|
</pre>
|
||
|
|
||
|
<p> </p>
|
||
|
|
||
|
<p><strong>提示:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><code>1 <= k <= n <= 10<sup>9</sup></code></li>
|
||
|
</ul>
|