Count Numbers With Unique Digits
Return how many whole numbers x with 0 <= x < 10**n have no repeated digit (for example 11 and 101 repeat a digit, 102 does not).
Example 1
n 2
returns 91
0 to 99 except 11, 22, ..., 99: 91 numbers.
Constraints
0 <= n <= 6
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Math problems
- Count PrimesMedium
- Day of the WeekMedium
- Fast PowerMedium
- Friday the 13th CountMedium
- Last Digit of a PowerMedium
- Last Person StandingMedium
- Minimum Moves to Equal ElementsMedium
- Multiply StringsMedium