mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
30 lines
900 B
HTML
30 lines
900 B
HTML
|
<p>某班级学号记录系统发生错乱,原整数学号序列 <code>[0,1,2,3,4,...]</code> 分隔符丢失后变为 <code>01234...</code> 的字符序列。请实现一个函数返回该字符序列中的第 <code>k</code> 位数字。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>k = 5
|
|||
|
<strong>输出:</strong>5
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 2:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<strong>输入:</strong>k = 12
|
|||
|
<strong>输出:</strong>1
|
|||
|
<strong>解释:</strong>第 12 位数字在序列 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... 里是 1 ,它是 11 的一部分。</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>提示:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li><code>0 <= k < 2<sup>31</sup></code></li>
|
|||
|
</ul>
|
|||
|
|
|||
|
<p>注意:本题与主站 400 题相同:<a href="https://leetcode-cn.com/problems/nth-digit/">https://leetcode-cn.com/problems/nth-digit/</a></p>
|
|||
|
|
|||
|
<p> </p>
|