values and an integer min_len. Among all contiguous stretches of the array whose length is at least min_len, return the largest average.
Answers within 10⁻⁵ of the exact value are accepted.values=[4, -2, 6, 1, 3], min_len=2 → 3.5
The best stretch is [6, 1] with average 3.5. Longer ones do worse, e.g. [6, 1, 3] averages about 3.33.
values=[-3, -1, -8], min_len=3 → -4.000001907348633
Only the whole array qualifies: (-3 - 1 - 8) / 3 = -4.
values=[4, -2, 6, 1, 3], min_len=2
3.5
Run checks the first 3 tests in your browser. Submit checks all 80 tests on the server, hidden ones included.