Design a class to find the kth largest element in a stream.
Note that it is the kth largest element in the sorted order, not the kth distinct element.
Implement the KthLargest class:
KthLargest(int k, int[] nums) — Initializes the object with the integer k and the stream of test scores nums.int add(int val) — Adds a new test score val to the stream and returns the element representing the kth largest element in the pool of test scores so far.0 <= nums.length <= 10^41 <= k <= nums.length + 1-10^4 <= nums[i] <= 10^4-10^4 <= val <= 10^410^4 calls will be made to add["KthLargest", "add", "add", "add", "add", "add"]
[[3, [4, 5, 8, 2]], [3], [5], [10], [9], [4]]
[null, 4, 5, 5, 8, 8]["KthLargest", "add", "add", "add", "add"]
[[4, [7, 7, 7, 7, 8, 3]], [2], [10], [9], [9]]
[null, 7, 7, 7, 8]