Build the PrimitiveEasy
Kth Largest Element in a Stream
Implement `KthLargest(k, nums)` with `add(val)` returning the kth largest value seen so far.
Keeping everything sorted is O(n log n) per add. Keep a *min*-heap of exactly the k largest values instead: its root is the kth largest, and anything smaller than the root can be discarded immediately. The counter-intuitive part — a min-heap for a "largest" query — is the question.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.