Available question text
Count the number of contiguous subarrays whose product is even — equivalently, subarrays that contain at least one even element. Solve in O(n) by complementary counting: total subarrays minus subarrays made entirely of odd numbers (sum len*(len+1)/2 over contiguous odd segments).
Related questions
Continue with questions that share topics or the same question type.
- Count Even-Product Triplets
Coding
- Count Number of Nice Subarrays
Coding · Array · Hash Table · Math
- Count the Number of Beautiful Subarrays
Coding
- Count the Number of Good Subarrays
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2495. Number of Subarrays Having Even Product
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source