Easy Python Solution


  • 1
    class Solution(object):
        def findNthDigit(self, n):
            """
            :type n: int
            :rtype: int
            """
            n = n - 1
            
            for digit in range(1, 11):
                pre = 10 ** (digit - 1)
                
                if n < 9 * pre * digit:
                    return int(str(pre + n / digit)[n % digit])
                
                n -= 9 * pre * digit
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.