Problem Statement |
| | Consider the set of numbers formed by taking every number between low and high, inclusive, and sorting the digits of each number in non-increasing order (the numbers are initially written without any extra leading zeros). Return the number of distinct numbers in this new set. |
| |
Definition |
| | | Class: | DistinctDigits | | Method: | count | | Parameters: | int, int | | Returns: | int | | Method signature: | int count(int low, int high) | | (be sure your method is public) |
|
| |
|
| |
Constraints |
| - | high will be between 1 and 100,000,000 (10^8), inclusive. |
| - | low will be between 1 and high, inclusive. |
| |
Examples |
| 0) | |
| | | Returns: 20 | | All of the integers between 1 and 20 have distincts sets of digits. |
|
|
| 1) | |
| | | Returns: 29 | | "21" has the same digits as "12" when sorted. All the rest are still distinct. |
|
|
| 2) | |
| | |
| 3) | |
| | |
| 4) | |
| | |
| 5) | |
| | |