Dsa
Prefix Sum
Medium
K-Subarray Average Minimization
You are tasked with finding the smallest average of any contiguous subarray of a given length `k`. Implement a function that reads an array and `k`, and returns the smallest average.
Example Input:
5
1 3 2 5 1
2
Example Output:
1.5
Key concepts
prefix_sumaveragesubarray
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now