今天在做347.前K个高频元素时,需要用到最小堆,实现如下: PriorityQueue<int[]> queue = new PriorityQueue<int[]>(new Comparator<int