class Solution {
public int findKthLargest(int[] nums, int k) {
int n = nums.length;
k = n + 1 - k;
PriorityQueue<Integer> pq = new PriorityQueue<>();
for(int x: nums) pq.offer(x);
for(int i = 0; i < k; i ++ ){
int x = pq.poll();
if(i == k - 1) return x;
}
return 0;
}
}