Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays Having Even Product

Number of Subarrays Having Even Product counts the nonempty contiguous portions of an integer array whose elements multiply to an even number, and returns that total.

Statement

Given an array of integers nums, return the total number of subarrays where the product of all elements is an even number.

A subarray is a contiguous non empty sequence of elements within an array.

Constraints:

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

  • 1≤1 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Subarrays Having Even Product

Number of Subarrays Having Even Product counts the nonempty contiguous portions of an integer array whose elements multiply to an even number, and returns that total.

Statement

Given an array of integers nums, return the total number of subarrays where the product of all elements is an even number.

A subarray is a contiguous non empty sequence of elements within an array.

Constraints:

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

  • 1≤1 \leq nums[i] ≤105\leq 10^5