Design a logger that returns top-K messages | Google Interview Question