one line ugly python recursive


  • 0
    W
    return 0 if n<0 else [1,10][n] if n in (0,1) else 9*reduce(operator.mul,[9-k+2 for k in range(2,n+1)]+[1])+self.countNumbersWithUniqueDigits(n-1)
    
    

Log in to reply
 

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