Problems > Repdigits in Range > Editorial

Repdigits in Range — Solution & Editorial

Back to the Problem

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)