← Questions

Moving average from a data stream

0
MetaCodingLast asked Jan 2026

Implement a class that receives numbers one at a time and returns the average of the last size values after each one, in constant time per call, keeping a running sum and a queue of the window.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding