class Solution {
public int findKthLargest(int[] nums, int k) {
PriorityQueue<Integer> h = new PriorityQueue<>((n1,n2)->n1-n2);
for(int i:nums){
h.add(i);
if(h.size()>k){
h.poll();
}
}
return h.poll();
}
}
【14】N的二进制中1的个数
猜你喜欢
转载自www.cnblogs.com/Jun10ng/p/12355136.html
今日推荐
周排行