Find a contiguous subarray whose length is exactly k and return the maximum average value among all possible subarrays of length k.
Any answer with a calculation error less than 10-5 will be accepted.
Example 1:
Input: nums = [1,12,-5,-6,50,3], k = 4
Output: 12.75000
Explanation: Subarray: [12,-5,-6,50]
Sum = 12 + (-5) + (-6) + 50 = 51
Average = 51 / 4 = 12.75
This becomes the maximum average among all subarrays of size 4.
Example 2:
Input: nums = [5], k = 1
Output: 5.00000
Explanation: The only subarray available is: [5]
Average = 5 / 1 = 5
Example 3:
Input: nums = [0,4,0,3,2], k = 1
Output: 4.00000
Explanation: When k = 1, every individual element forms a valid subarray.
The maximum value becomes: 4