Definition at line 5 of file main.cpp.
◆ findKthLargest()
| int Solution::findKthLargest |
( |
vector< int > & |
nums, |
|
|
int |
k |
|
) |
| |
|
inline |
Definition at line 8 of file main.cpp.
9 {
10 priority_queue<int> max_heap(nums.begin(), nums.end());
11 int kth = max_heap.top();
12 max_heap.pop();
13 for (int i = 1; i < k; ++i)
14 {
15 kth = max_heap.top();
16 max_heap.pop();
17 }
18 return kth;
19 }
The documentation for this class was generated from the following file: