Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1248. Count Number of Nice Subarrays
Count the number of contiguous subarrays that contain exactly k odd numbers in an integer array. The core challenge is to do this in linear time by using parity prefix counts (or by counting even-number gaps between odds) to compute how many subarrays end at each position.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.