DSAMaster Logo
DSAMaster
BackmediumArrays

Min Length Subarray with Bounded Average

Problem Description

You are given an array of integers values and a target average threshold. Determine the minimum length of a contiguous subarray such that the average of the elements in this subarray is less than or equal to threshold. If no such subarray exists, return -1.

Constraints

  • A is an array of integers.
  • avg is a number.
  • The length of A is between 1 and 10^6.
  • The elements of A are between -10^6 and 10^6.
00:00
Loading...

Sign in to Solve

Access the full code editor, ThinkBuddy AI hints, and track your progress.

Sign in Free
Test Cases & Output
Enter test input here...
Click "Run Code" to execute