Moving Average over a Data Stream

Implement a sliding-window moving average over a data stream.

Given a window size k and a stream of numbers arriving in time order, after reading each new value x, output the average of the most ...

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: