Tap here to switch tabs
Problem
Submissions

Problem: Count Number of Nice Subarrays

med
30 min
Try to solve the Count Number of Nice Subarrays problem.

Statement

Given an integer array nums and an integer k, return the number of contiguous subarrays of nums that contain exactly k odd numbers.

Note: A subarray is a contiguous sequence of elements within nums.

Constraints:

  • 11 \leq nums.length 50000\leq 50000

  • 11 \leq nums[i] 105\leq 10^5

  • 11 \leq k \leq nums.length

Tap here to switch tabs
Problem
Submissions

Problem: Count Number of Nice Subarrays

med
30 min
Try to solve the Count Number of Nice Subarrays problem.

Statement

Given an integer array nums and an integer k, return the number of contiguous subarrays of nums that contain exactly k odd numbers.

Note: A subarray is a contiguous sequence of elements within nums.

Constraints:

  • 11 \leq nums.length 50000\leq 50000

  • 11 \leq nums[i] 105\leq 10^5

  • 11 \leq k \leq nums.length