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:

C

CloudKitchens


Question Timeline

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

Early June, 2025

C

CloudKitchens

Senior

Comments

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