KCG interview question

Solve the moving average problem