Ctrl K
Problem

Best Window Average

Easy · Best Window Average

A sensor logged a series of integer readings, `readings`. Pick `width` consecutive readings whose arithmetic mean is as large as possible and return that mean. An answer within 10⁻⁵ of the exact value is accepted. Recomputing each window's sum from scratch costs O(n · width); aim for O(n).…

Solve the problem →