Skip to content

Missing Test Case - 1445. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold #32198

@Tushar3453

Description

@Tushar3453

LeetCode Username

Tushar3147

Problem Number, Title, and Link

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

Bug Category

Missing test case (Incorrect/Inefficient Code getting accepted because of missing test cases)

Bug Description

[2,2,2,2,5,5,5,8]
3
4
[11,13,17,23,29,31,7,5,2,3]
3
5

Language Used for Code

Java

Code used for Submit/Run operation

class Solution {
    public int numOfSubarrays(int[] arr, int k, int threshold) {
        int left=0;
        int right=0;
        int n=arr.length;
        int count=0;
        int sum=0;
        while(right<n){
            sum+=arr[right];
            if(left<=right && right-left+1 == k){
                if(sum/k >= threshold) count++;
                sum-=arr[left];
                left++;
            }
            right++;
        }
        return count;
    }
}

Expected behavior

Internal Error
You've found a test case the system can't handle. Please submit them to help us improve. Thank you!
this is what happened
it should have passed testcases.

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions