Practice / Software

Top k most frequent items

Medium · Coding (typed)

Given a list of words and k, return the k most frequent words. Do better than sorting all distinct words if you can, and say what you would do if the list did not fit in memory.

Create a free account to answer it and get scored on what a strong answer covers.