Ninja technique🥷 to ACE DSA Interviews.
n-k
th element.k-1
elements from it.class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue<int> pq;
for(auto x:nums){
pq.push(x);
}
while(--k){
pq.pop();
}
return pq.top();
}
};