Given a non-negative integer n, return how many numbers in the range [0, 10^n) have all digits unique. Pattern focus: Digit DP. Build numbers digit by digit while tracking which digits are already used.
n = number of digits
count of numbers with all unique digits in [0, 10^n)
Example 1:
Input:
n = 0
Output:
1
Explanation:
Only the number 0 is in the range [0, 1).
Example 2:
Input:
n = 1
Output:
10
Explanation:
The numbers 0 through 9 all have unique digits.
Example 3:
Input:
n = 2
Output:
91
Explanation:
There are 91 numbers from 0 to 99 with all digits unique.