Amazon interview question

Get top k elements in a stream