We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb4e867 commit b36f675Copy full SHA for b36f675
problems/0347.前K个高频元素.md
@@ -142,7 +142,7 @@ class Solution {
142
143
Set<Map.Entry<Integer, Integer>> entries = map.entrySet();
144
// 根据map的value值正序排,相当于一个小顶堆
145
- PriorityQueue<Map.Entry<Integer, Integer>> queue = new PriorityQueue<>((o1, o2) -> o1.getValue() - o2.getValue());
+ PriorityQueue<Map.Entry<Integer, Integer>> queue = new PriorityQueue<>((o1, o2) -> o2.getValue() - o1.getValue());
146
for (Map.Entry<Integer, Integer> entry : entries) {
147
queue.offer(entry);
148
if (queue.size() > k) {
0 commit comments