Count Subarrays With Exactly K Odd Numbers

Asked at Expedia · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

Given an array of integers and a number `k`, count the contiguous pieces of the array that contain exactly `k` odd numbers. Only whether each element is odd or even matters, not how large it is.

Loading the problem…