Problem 1248 · Medium

Count Number of Nice Subarrays

Count contiguous subarrays that contain exactly k odd numbers. The visual marks the odd positions and counts the runs of even numbers between them.

Open the interactive visualisation