Search
⌘K

Leetcode 703. Kth Largest Element in a Stream

Maintain the kth largest element in a dynamic stream: implement a class initialized with k and an initial array that supports add(val) and returns the current kth largest after each insertion. Expect up to 10^4 add operations, so updates must be more efficient than resorting the whole list each time.

Asked at:

Microsoft

Microsoft

C

CloudKitchens


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early February, 2026

Microsoft

Microsoft

Senior

The question was exactly to print the top K largest elements in a data stream and the follow up was to find the median of the stream.

Early June, 2025

C

CloudKitchens

Senior

Your account is free and you can post anonymously if you choose.