Count Numbers with Unique Digits

Medium · Math & Number Theory · about 15 minutes

Asked at Google, Amazon, Microsoft.

Given n (0 ≤ n ≤ 8), return how many integers x with 0 ≤ x < 10ⁿ have all distinct digits.