class Solution {
public:
int findKth(vector<int> a, int n, int K) {
// write code here
sort(a.begin(),a.end(),cmp);
// sort(a.begin(), a.end(), greater<int>());
return a[K-1];
}
static bool cmp(int i, int j){
return i > j;
}
};
class Solution {
public:
int findKth(vector<int> a, int n, int K) {
// write code here
priority_queue<int>q;
for(int n : a){
q.push(n);
}
a.clear();
int res = 0;
for(int i = 0; i < K; i++){
res = q.top();
q.pop();
}
return res;
}
};