Design a data structure that supports adding integers and finding the median.
MedianFinder(): Initialize the object.
addNum(num): Add num to the data structure.
findMedian(): Return the median of all elements added so far.
With operations addNum(1), addNum(2), findMedian(), addNum(3), findMedian():
- After adding 1 and 2: sorted is
[1, 2]. Median =(1 + 2) / 2 = 1.5. - After adding 3: sorted is
[1, 2, 3]. Median =2.
Constraints: . Up to operations.