🟡 剑指 Offer II 076. 数组中的第 k 大的数字
LeetCode 提示
题目难度 中等
原题链接 🔗 leetcode
题解1#
class Solution {    public int findKthLargest(int[] nums, int k) {        PriorityQueue<Integer> pq = new PriorityQueue<>();        for (int num : nums) {            pq.offer(num);
            if (pq.size() > k) {                pq.poll();            }        }
        return pq.peek();    }}