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)/字典序的第K小数字 [k-th-smallest-in-lexicographical-order].html
2022-03-29 12:43:11 +08:00

27 lines
665 B
HTML

<p>给定整数&nbsp;<code>n</code>&nbsp;&nbsp;<code>k</code>,返回&nbsp;&nbsp;<code>[1, n]</code>&nbsp;中字典序第&nbsp;<code>k</code>&nbsp;小的数字。</p>
<p>&nbsp;</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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= k &lt;= n &lt;= 10<sup>9</sup></code></li>
</ul>