Python O(1), 1-line


  • 0
    J

    Once you make the correct observations, it will be faster to compute all answers by hand:

    def countNumbersWithUniqueDigits(self, n):
        return [1,10,91,739,5275,32491,168571,712891,2345851][n]
    

Log in to reply
 

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