Repdigits in Range — Solution & Editorial
A repdigit of length L is d×(111...1) for d in 1..9. Enumerate lengths and digits (only ~9×18 candidates), counting those ≤ the bound; use a prefix difference over the range.
Complexity: O(digits)
A repdigit of length L is d×(111...1) for d in 1..9. Enumerate lengths and digits (only ~9×18 candidates), counting those ≤ the bound; use a prefix difference over the range.
Complexity: O(digits)