Data Structures & AlgorithmsModerateProduct Company SDE · heap round

Problem: What does the two-heap technique compute in a data stream?

  1. A. The shortest path to every node
  2. B. The number of connected components
  3. C. The running median
  4. D. The longest palindromic substring

Correct answer: C. The running median

A max-heap of the lower half and a min-heap of the upper half keep the median at their tops.

More Coding Interview Problems questions

Exams that ask this topic