Count Number of Nice Subarrays

Medium · Hashing · about 20 minutes

Asked at Meta, Amazon, Google, ByteDance, Bloomberg.

Call a contiguous slice of nums nice when exactly k of its values are odd. How many nice slices does nums have?

Related guides