public static int countNumbersWithUniqueDigits(int n) {

if (n == 0) {

return 1;

}

```
// idea : numbers in 2 digit with no repeat : 9 * 9 ( first is 9 because
// we cannot start with 0)
int sum = 10;
for (int i = 2; i <= n; i++) {
int j = i;
int multiplier = 9;
int start = 9;
while (j > 1) {
multiplier = multiplier * start;
start--;
j--;
}
sum += multiplier;
}
return sum;
}
```