#347
Top K Frequent Elements
medium · 65.9% accepted · 19,351 likes · top 71%
array · hash table · divide and conquer · sorting · heap (priority queue) · bucket sort · counting · quickselect
Description
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.
Solution