Facebook | Phone Screen | Stream Median

implement a class that can (1) accept an integer and (2) query the median of all the integers that have been accepted.
Example:
c.add(1)
c.add(2)
c.add(3)
c.median() >2
The interview wants O(n) time for add funciton and O(1) time for median function
https://leetcode.com/problems/find-median-from-data-stream/

Result: rejected

Comments (4)