FastPrepCount Three-Digit Numbers with Distinct Digits

Count Three-Digit Numbers with Distinct Digits

ZipRecruiter logoZipRecruiter● EasyFULLTIMENEW GRADOA
Learn

Problem statement

You are given an inclusive range [left, right] containing only three-digit positive integers.

Return how many values in the range have three pairwise distinct decimal digits.

Function

countDistinctThreeDigitNumbers(left: int, right: int) → int

Examples

Example 1

left = 876right = 890return = 3

The qualifying values are 876, 879, and 890.

Example 2

left = 100right = 105return = 4

The qualifying values are 102, 103, 104, and 105.

Constraints

  • 100 <= left <= right <= 999

More ZipRecruiter problems

See ZipRecruiter hiring insights
public int countDistinctThreeDigitNumbers(int left, int right) {
    // Write your code here.
}
left876
right890
expected3
Checking account…