Search
⌘K

Leetcode 1567. Maximum Length of Subarray With Positive Product

Find the longest contiguous subarray whose product is positive. The array can be split by zeros into independent segments, and within each segment the parity of negative numbers (or tracking lengths of subarrays with positive/negative product) determines whether the whole segment or a trimmed prefix/suffix gives the maximum length.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.