Given an integer array nums and integer k, find a contiguous subarray of length k with the maximum average value. Return the maximum average.
Input: nums = [1,12,-5,-6,50,3], k = 4 Output: 12.75 (subarray [12,-5,-6,50])
Input: nums = [5], k = 1 Output: 5.0
Jnaneshwara Reddy Satti
Builder · ClearCode
Hi — I'm a 21yo CS grad from India. I built ClearCode while recovering from a surgery, because I genuinely believe DSA should be visual, free, and accessible to everyone. No VC funding. No team. Just me, my laptop, and a lot of chai. ☕
If ClearCode helped you understand even one concept — consider supporting it. Every rupee keeps the servers running and new videos coming.