Problems > Contains a Zero > Editorial

Contains a Zero — Solution & Editorial

Back to the Problem

Digit DP with prefix difference and tight/leading flags.

Complexity: O(digits · states)

Watch out: Only non-leading zeros count — a leading zero is not part of the number.