Rolling Mean with O(1) Update

Implement a fixed-window rolling mean calculator over a stream of integers.

Elements arrive one by one. Given a window size k, after each new element arrives, output the average of the most recent ...

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: