Numbers with distinct digits

Write codeMedium20 min

Your task

Given an integer k, count how many non-negative integers x with 0 <= x < 10^k have all distinct digits. For k = 0 the range is just {0}, so the answer is 1. 0 <= k <= 9.

Examples

count_numbers_with_unique_digits(k: int) -> int
Example 1
Inputcount_numbers_with_unique_digits(2)
Output91