Find top-K frequent elements in a stream | Meta Interview Question