Tap here to switch tabs
Problem
Submissions

Problem: Maximum Length of Subarray With Positive Product

med
30 min
Try to solve the Maximum Length of Subarray With Positive Product problem.

Statement

Given an array of integers nums, determine the maximum length of a contiguous subarray whose elements have a strictly positive product.

Return the maximum length found. If there is no subarray with a positive product, return 00.

Note: A subarray is a contiguous sequence of elements within an array. A product equal to 00 is not considered positive.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Length of Subarray With Positive Product

med
30 min
Try to solve the Maximum Length of Subarray With Positive Product problem.

Statement

Given an array of integers nums, determine the maximum length of a contiguous subarray whose elements have a strictly positive product.

Return the maximum length found. If there is no subarray with a positive product, return 00.

Note: A subarray is a contiguous sequence of elements within an array. A product equal to 00 is not considered positive.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9