- Made a mistake trying to use pure math. But it does involve some maths.
number of n-digit nums with unique digits.
dp[i]are nums that has
one more digitthan
- We cannot use those
0 - 9that have been used before. How many left for us?
9 * 9(The first 9 is 0-9, then we can use 0 on the last digit, still 9 numbers)
9 * 9 * 8.
- Based on permutation rules,
dp[i] = dp[i-1] * (11 - i).
Given an integer
n, return the count of all numbers with unique digits, x, where
0 <= x < 10^n.
Input: n = 2
if (n === 0) return 1;