Quick Overview

Compute the median after every insertion into an integer stream without repeatedly sorting the full prefix. Practice maintaining balanced data structures, handling duplicates and negatives, producing even-count averages safely, and meeting large-input time bounds.

Compute the Median After Each Stream Insertion

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Quick Answer: Compute the median after every insertion into an integer stream without repeatedly sorting the full prefix. Practice maintaining balanced data structures, handling duplicates and negatives, producing even-count averages safely, and meeting large-input time bounds.

Loading…