# Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold (Leetcode 1343)

Problem Link: <https://leetcode.com/problems/number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold/>

```python
class Solution:
    def numOfSubarrays(self, arr: List[int], k: int, threshold: int) -> int:
        
        
        n=len(arr)
        i=0
        j=0
        s=0
        c=0
        while(j<n):
            
            s=s+arr[j]
            
            if(j-i+1<k):
                j+=1
                
            elif(j-i+1==k):
                if(s/k>=threshold):
                    c+=1
                
                s=s-arr[i]
                
                i+=1
                j+=1
        
        return c
```
