Chewy interview question

Top k frequent elements (JavaScript)