Problems > Even Number of Digits > Editorial

Even Number of Digits — Solution & Editorial

Back to the Problem

Digit DP with prefix difference and tight/leading flags.

Complexity: O(digits · states)

Watch out: Track digit-count parity, but leading zeros do not add to the digit count.