Nth Digit

Given an integer n, return the n^th digit of the infinite integer sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...].

Example 1
Inputn = 3
Output3
The 3rd digit of the sequence is 3.
Example 2
Inputn = 11
Output0
The 11^th digit of the sequence is a 0, which is part of the number 10.

Constraints

  • 1 <= n <= 2^31 - 1

Asked at 7 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate