Amazon interview question

coding top k frequent elements