```
class compare{
public:
bool operator()(const int & a, const int & b)
{
return a>b;
}
};
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue<int, vector<int>,compare>queue;
for(int i=0;i<nums.size();i++)
{
if(queue.size()<k)queue.push(nums[i]);
else if(nums[i]>queue.top()){
queue.pop();
queue.push(nums[i]);
}
}
return queue.top();
}
```

};