The median of a list of numbers is defined as the middle value in a sorted list. When the list has an even number of elements, the median is the average of the two middle values.
Examples
Input: methods = ["add","getMedian"], params = [4,null]
Output: [null,4]
Explanation: Add 4 to the stream, then find the median, which is 4.
Input: methods = ["add","add","getMedian"], params = [10,20,null]
Output: [null,null,15]
Explanation: Add 10 and 20 to the stream. The median of [10, 20] is (10 + 20) / 2 = 15.
Input: methods = ["add","add","add","getMedian"], params = [1,2,3,null]
Output: [null,null,null,2]
Explanation: Add 1, 2, 3 to the stream. The median of [1, 2, 3] is 2.