Optiver interview question

Implement some sort of buffer