leetcode-347-前K個高頻元素

//利用優先隊列(注意優先隊列的寫法,包括創建最小堆還是最大堆,包括寫不寫自己的比較函數) //pair比較時只比較第一個元素 class Solution { public:     vector<int> topKFrequent(vector<int>& nums, int k) {         unordered_map<int, int> freq;  //元素,頻率        
相關文章
相關標籤/搜索