Given an array consisting of
n
integers, find the contiguous subarray whose
length is greater than or equal to
k
that has the maximum average value. And you need to output the maximum average value.
Example 1:
Input: [1,12,-5,-6,50,3], k = 4 Output: 12.75 Explanation: when length is 5, maximum average value is 10.8, when length is 6, maximum average value is 9.16667. Thus return 12.75.
Note:
k
<=
n
<= 10,000.