用优先队列
public PriorityQueue<Integer> kthLargest(int k, int[]a) { PriorityQueue<Integer> q = new PriorityQueue<>(k); for (int i : a) { if (q.size() < k) { q.offer(i); }else { if (i > q.peek()) { q.poll(); q.offer(i); } } } return q; }