1248. Count Number of Nice Subarrays
Problem Statement
Given an array of integers nums
and an integer k
. A continuous subarray is called nice if there are k
odd numbers on it.
Return the number of nice sub-arrays.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= nums.length <= 50000
1 <= nums[i] <= 10^5
1 <= k <= nums.length
Intuition
Links
Video Links
Approach 1:
Approach 2:
Approach 3:
Approach 4:
Similar Problems
Previous930. Binary Subarrays With SumNext1358. Number of Substrings Containing All Three Characters
Last updated