Given an unsorted array return the k most frequest elements in O(N) time.
For example, [1,2,1,1,2,3,4,2,1,1,1,3] and k=2 return [1,2]
I gave a O(N * logK) solution using heap and a hashmap, does anyone know the O(N) solution to this?