Problems > Longest Zero Gap > Editorial

Longest Zero Gap — Solution & Editorial

Back to the Problem

Split on 1s (or scan with a counter) and take the longest zero block.

Complexity: O(|S|)