Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 554 Bytes

File metadata and controls

13 lines (10 loc) · 554 Bytes

Problem 11: Real-time Equilibrium

Problem Statement

The median is the middle value in an ordered integer list. Design a data structure that supports the following two operations:

  • void addNum(int num) - Add an integer number from the data stream to the data structure.
  • double findMedian() - Return the median of all elements so far.

Input Format

  • Method calls.

Example

Input: ["MedianFinder", "addNum", "addNum", "findMedian", "addNum", "findMedian"] [[], [1], [2], [], [3], []]
Output: [null, null, null, 1.5, null, 2.0]