Equal Zero and One Block Substrings

Asked at Dell · Coding Questions · Difficulty: Easy · Last asked Jul 15, 2026

Given a string of `0`s and `1`s, count its substrings that consist of a block of one character immediately followed by an equally long block of the other character, such as `"01"`, `"1100"` or `"000111"`. Substrings at different positions are counted separately, even when they are equal as strings.

Loading the problem…