class Solution {
public:
int findKthLargest(vector<int>& s, int k) {
priority_queue<int> pq;
for(int i = 0; i < s.size(); i++){
pq.push(s[i]);
}
for(int i = 1; i < k; i++){
pq.pop();
}
return pq.top();
}
};
priority_queue<int> pq为优先队列
s.size()可得到数组s的大小,下看示例