Update 0347.前K个高频元素.md

原文打错字了:第207行应为“扫描所有频率的数值”,原文为“扫面所有频率的数值”
This commit is contained in:
ZerenZhang2022
2022-11-27 13:57:49 -05:00
committed by GitHub
parent 5fc31873aa
commit 2bc1a47c12

View File

@ -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