# 44.数字序列中某一位的数字

### 一、 题目

数字以0123456789101112131415…的格式序列化到一个字符序列中。

在这个序列中，第5位（从下标0开始计数）是5，第13位是1，第19位是4，等等。

请写一个函数，求任意第n位对应的数字。

示例 1：

输入：n = 3

输出：3

示例 2：

输入：n = 11

输出：0

限制：

0 <= n < 2^31

注意：本题与主站 400 题相同：<https://leetcode-cn.com/problems/nth-digit/>

来源：力扣（LeetCode）

链接：<https://leetcode-cn.com/problems/shu-zi-xu-lie-zhong-mou-yi-wei-de-shu-zi-lcof>

著作权归领扣网络所有。商业转载请联系官方授权，非商业转载请注明出处。

### 二、 分析

本题我们先要看看为了找到下标为 `n` 的数字 `x` ，我们需要什么：

* 在那个数中 `num`
* 其在 `num` 中的下标
* 即可求得 `x`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ryukiedev.gitbook.io/wiki/shu-ju-jie-gou-yu-suan-fa/jian-zhi-offerswift/44.-shu-zi-xu-lie-zhong-mou-yi-wei-de-shu-zi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
