KCG Interview Question

Solve the moving average problem