values and a number odd_count. Count the contiguous stretches (subarrays) of the array that contain exactly odd_count odd numbers.
Stretches with different boundaries are counted separately, even if they hold the same numbers.values=[3, 8, 5, 6, 7], odd_count=2 → 4
Exactly two odd numbers are found in [3, 8, 5], [3, 8, 5, 6], [5, 6, 7] and [8, 5, 6, 7], so the answer is 4.
values=[10, 12], odd_count=1 → 0
The array has no odd numbers at all.
values=[1, 1, 1], odd_count=1 → 3
values=[3, 8, 5, 6, 7], odd_count=2
4
Run checks the first 3 tests in your browser. Submit checks all 63 tests on the server, hidden ones included.