LeetCode - 295 数据流的中位数 (大根堆 + 小根堆)
大根堆+小根堆
class MedianFinder {
private PriorityQueue<Integer> maxHeap;
private PriorityQueue<Integer> minHeap;
public MedianFinder() {
//大根堆
maxHeap = new PriorityQueue<>(new Comparator<Integer>(){
.
原创
2022-05-18 08:01:49 ·
126 阅读 ·
0 评论