Citi interview question

Propose an efficient code that count moving average.