Problems > At Most K Odd Numbers > Editorial

At Most K Odd Numbers — Solution & Editorial

Back to the Problem

Sliding window where the constraint is the count of odd elements: expand right, shrink while the count exceeds K.

Complexity: O(N)