Problem Statement | |||||||||||||
A number x is called equidigit if each digit that appears in the decimal notation of x appears the same number of times. (x must be written with no leading zeroes.) For example, the numbers 5, 239, 333888 and 566353 are equidigit. Given a string representing a number n, return the smallest equidigit number that is greater than or equal to n. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The answer always fits into a 64-bit signed integer. | ||||||||||||
Constraints | |||||||||||||
- | n will contain only digits, and will represent an integer between 1 and 10^18, inclusive, with no leading zeros. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|