Given an integer n, return the count of all numbers with unique digits, x, where 0 <= x < 10n.
Input: n = 2
Output: 91
Explanation: The answer should be the total numbers in the range of 0 ≤ x < 100, excluding 11,22,33,44,55,66,77,88,99
Input: n = 0
Output: 1
0 <= n <= 8In a brute force approach, we can generate all numbers with up to n digits and count those with unique digits. However, this method will be computationally expensive due to the vast number of possibilities, making it less suitable for larger values of n.
n digits.d is the number of digits, as we have to check each number up to 10^n.Instead of generating each number, we can use combinatorial counting to determine how many numbers have unique digits.
n:n.