More Even Digits than Odd — Solution & Editorial
Digit DP with prefix difference; carry tight and leading-zero flags.
Complexity: O(digits · states)
Watch out: Leading zeros must not be counted as even digits — keep the balance at 0 through them.
Digit DP with prefix difference; carry tight and leading-zero flags.
Complexity: O(digits · states)
Watch out: Leading zeros must not be counted as even digits — keep the balance at 0 through them.