Problem 1567 · Medium

Maximum Length of Subarray With Positive Product

Find the longest subarray with a positive product by tracking the lengths since the last zero and the sign parity. The visual highlights the signs and the best window.

Open the interactive visualisation