#643 - Maximum Average Subarray I
Given an integer array nums of length n and an integer k, find a contiguous subarray of length k that has the maximum average value, and return that average. The answer will be accepted if the error is less than 10⁻⁵.
| Input | Output |
|---|---|
nums = [1,12,-5,-6,50,3], k = 4 | 12.75 |
nums = [5], k = 1 | 5.0 |
nums = [0,4,0,3,2], k = 1 | 4.0 |