Design a class that finds the kth largest element in a stream.
KthLargest(k, nums): Initialize with k and an initial stream nums.
add(val): Add val to the stream and return the kth largest element.
With k = 3 and nums = [4, 5, 8, 2]:
- Stream starts as
[4, 5, 8, 2]. 3rd largest is4. add(3): stream is[4, 5, 8, 2, 3]. 3rd largest is4.add(5): stream is[4, 5, 8, 2, 3, 5]. 3rd largest is5.add(10): stream is[...]. 3rd largest is5.
Constraints: . Up to calls to add.