Problem
You get an integer array nums and a length k. Look at every contiguous subarray of length exactly `k` and return the highest average among them.
Example 1
- Input
- nums = [1, 12, -5, -6, 50, 3], k = 4
- Output
- 12.75
- Why
- (12 - 5 - 6 + 50) / 4
Example 2
- Input
- nums = [5], k = 1
- Output
- 5.0
Answers within 10^-5 of the true value are accepted.
Constraints
1 <= k <= nums.length <= 10^5-10^4 <= nums[i] <= 10^4