n digits unique number is: 9 * 9 * 8 ... * (11 - n), below code is AC, but not sure why n = 0 should return 2.

```
public class Solution {
public int countNumbersWithUniqueDigits(int n) {
if (n <= 0) return 2; // when n = 0, there is 0 and 1
int c = 9, res = 0;
for (int i = 1; i <= n && i <= 10; i++) {
if (i == 1) res += c + 1; // as from hpplayer below, n = 1, should be 11 (c + 2 here) as 0 ~10 all valid
else {
c *= 11 - i;
res += c;
}
}
return res;
}
}
```