Alternating Parity Stretch — Solution & Editorial
Run-length logic on the parity sequence: extend while parity differs from the previous element.
Complexity: O(N)
Run-length logic on the parity sequence: extend while parity differs from the previous element.
Complexity: O(N)