K-th Largest Stock Price in Continuous Stream

Asked at CME Group · Coding Questions · Difficulty: Medium

Prices of a stock arrive one at a time as a stream. After each new price arrives, report the K-th largest price seen so far, counting repeated prices separately. If fewer than K prices have arrived, report -1.

Loading the problem…