JPMorgan ChaseOA #35
Count Numbers Without Repeating Digits
Estimated EasyJudge-ready
Topics (AI-labelled)Bits & MathSimulation
Count the non-negative integers in a closed range whose decimal digits are all different. 0 is written as the single digit 0 and counts as valid. The original statement is truncated; the rule is restored from the title and the original explanation that 10..13 includes 10, 12, and 13. The non-negative domain and the representation of 0 are an explicit protocol of this site.
Input
One line with start end. The original has no numeric bounds; this site uses 0≤start≤end≤10^18.
Output
Output a single integer answer.
Example 1
Input:
10 13
Output:
3
Example 2
Input:
0 11
Output:
11
Example 3
Input:
98 102
Output:
2
Example notes
The outputs of the three public examples are, in order: 3; 11; 2. These answers have been checked by independent enumeration or direct simulation.
Editorial
Loading solution…