Problems > Numbers That Contain D > Editorial

Numbers That Contain D — Solution & Editorial

Back to the Problem

Complement counting: numbers with NO digit D are easy to count by a digit walk (each free position has 9 choices); subtract from N.

Complexity: O(log N)