Problems > Digit Sum at Most 9 > Editorial

Digit Sum at Most 9 — Solution & Editorial

Back to the Problem

Digit DP with prefix difference and tight/leading flags.

Complexity: O(digits · states)