Design a system to find the kth largest element in a stream of numbers.
You are given an integer k, an initial array of integers nums, and an array additions representing new numbers added to the stream one at a time. For each addition, return the kth largest element in the stream after that number is added.
Note: The kth largest element is the kth largest in sorted order, not the kth distinct element.
Example 1:
Input: k = 3, nums = [4,5,8,2], additions = [3,5,10,9,4]
Output: [4,5,5,8,8]
Explanation:
Example 2:
Input: k = 1, nums = [], additions = [1,2,3]
Output: [1,2,3]
Explanation:
Example 3:
Input: k = 2, nums = [5,3], additions = [1,4,6]
Output: [3,4,5]
Explanation:
1 <= k <= nums.length + 10 <= nums.length <= 10⁴-10⁴ <= nums[i] <= 10⁴1 <= additions.length <= 10⁴-10⁴ <= additions[i] <= 10⁴k elements in the stream when each add is called.