Class Solution

java.lang.Object
g0301_0400.s0400_nth_digit.Solution

public class Solution extends Object
400 - Nth Digit.<p>Medium</p> <p>Given an integer <code>n</code>, return the <code>n<sup>th</sup></code> digit of the infinite integer sequence <code>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> n = 3</p> <p><strong>Output:</strong> 3</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> n = 11</p> <p><strong>Output:</strong> 0</p> <p><strong>Explanation:</strong> The 11<sup>th</sup> digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, &hellip; is a 0, which is part of the number 10.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= n <= 2<sup>31</sup> - 1</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • findNthDigit

      public int findNthDigit(int n)