Meta Interview Question

Implement a tree. The second question was about moving average