Problems > Alternating Parity Stretch > Editorial

Alternating Parity Stretch — Solution & Editorial

Back to the Problem

Run-length logic on the parity sequence: extend while parity differs from the previous element.

Complexity: O(N)