Compute a moving average on a stream | Atlassian Interview Question