mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-10 20:40:39 +08:00
Update 0347.前K个高频元素.md
原文打错字了:第207行应为“扫描所有频率的数值”,原文为“扫面所有频率的数值”
This commit is contained in:
@ -204,7 +204,7 @@ class Solution:
|
||||
#定义一个小顶堆,大小为k
|
||||
pri_que = [] #小顶堆
|
||||
|
||||
#用固定大小为k的小顶堆,扫面所有频率的数值
|
||||
#用固定大小为k的小顶堆,扫描所有频率的数值
|
||||
for key, freq in map_.items():
|
||||
heapq.heappush(pri_que, (freq, key))
|
||||
if len(pri_que) > k: #如果堆的大小大于了K,则队列弹出,保证堆的大小一直为k
|
||||
|
Reference in New Issue
Block a user