Moving Average over a Sliding Window
Implement a MovingAverage sliding-window statistics object.
The constructor receives a window size k. Each call to next(val) adds val to the stream and returns the average of the latest at mo...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
