Statement: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n.
class Solution { private int[] precalculated = new int[] { 1, 10, 91, 739, 5275, 32491, 168571, 712891, 2345851, 5611771, 8877691 }; public int countNumbersWithUniqueDigits(int n) { return precalculated[Math.min(n, 10)]; } }
沒有留言:
張貼留言