Ctrl K

Numbers Without Repeated Digits

Medium
You get an integer digits. Count the integers x with 0 ≤ x < 10^digits whose decimal form has no repeated digits, meaning each digit appears at most once. Numbers are written the usual way, without leading zeros.
Example 1
digits=1 → 10

The numbers 0 through 9 are single digits with nothing to repeat: 10 of them.

Example 2
digits=2 → 91

Among 0 to 99, only 11, 22, ..., 99 repeat a digit, which leaves 100 − 9 = 91.

Example 3
digits=0 → 1
Constraints
  • 0 ≤ digits ≤ 8
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsFewest Lines Through the Dots MediumPicks Without a Fixed Gap MediumSquare-Sum Chains HardA Fair Split of Colored Beads HardAll Balanced Bracket Strings Medium
loading Python…
Input
digits=1
Expected
10

Run checks the first 3 tests in your browser. Submit checks all 12 tests on the server, hidden ones included.