https://leetcode.com/problems/kth-largest-element-in-a-stream/description/
class KthLargest {public: priority_queue q; int k; KthLargest(int k, vector nums) { this->k = k; for (auto &i : nums) add(i); } int add(int val) { if (q.size() < k) { q.push(-val); } else { if (val > -q.top()) { q.pop(); q.push(-val); } } return -q.top(); }};/** * Your KthLargest object will be instantiated and called as such: * KthLargest obj = new KthLargest(k, nums); * int param_1 = obj.add(val); */