Question bank › Arrays
Dsa Arrays Medium

K-Element Subarray Average

Write a function to find the maximum average of any contiguous subarray of size K in a given array of integers. If K is larger than the array length, return 0. Input Format: - A single line with space-separated integers representing the array. - A second line containing an integer K. Output Format: - A float representing the maximum average of the K-sized subarrays. Example: Input: 1 3 2 5 4 3 Output: 4.0

Key concepts

arrayssubarraysaverages

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.