Problems > No Digit Appears Twice in a Row > Editorial

No Digit Appears Twice in a Row — Solution & Editorial

Back to the Problem

Digit DP with prefix difference and tight/leading flags.

Complexity: O(digits · states)