Practice Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Medium#1343
LeetCode ProblemNumber of Sub-arrays of Size K and Average Greater than or Equal to Threshold
Problem Statement
Given an array of integers arr and two integers k and threshold, return the number of sub-arrays of size k and average greater than or equal to threshold.
Source: Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
arr = [2,2,2,2,5,5,5,8], k = 3, threshold = 4
Output
3
# Example 2
Input
arr = [11,13,17,23,29,31,7,5,2,3], k = 3, threshold = 5
Output
6
Constraints
1 <= arr.length <= 10^5
1 <= arr[i] <= 10^4
1 <= k <= arr.length
0 <= threshold <= 10^4
Related LeetCode Problems
Practice more problems similar to Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.