Problems > Even Digit Product > Editorial

Even Digit Product — Solution & Editorial

Back to the Problem

Digit DP with prefix difference and tight/leading flags.

Complexity: O(digits · states)

Watch out: A leading zero is not part of the number, so it should not make the product even.