重写Arrays.sort

Arrays.sort(intervals, new Comparator<int[]>() {
@Override
	public int compare(int[] o1, int[] o2) {
		return o1[1] - o2[1];
	}
});

PriorityQueue maxHeap=new PriorityQueue(new Comparator() {
        @Override
        public int compare(Integer o1, Integer o2) {                
            return o2-o1;
        }
    });
PriorityQueue left = new PriorityQueue<>(Comparator.reverseOrder());

你可能感兴趣的:(力扣笔记)