← 返回 meta 的题目列表Top K Frequent Elements in Array with Optimized Time Complexity
类型:online_judge
meta
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Ensure the algorithm's time complexity is better than O(n log n) where n is the size of the array.
Example
Input
[1,1,1,2,2,3]
2