Design a Stream Top-K Class (Online Top-K Elements/Frequencies)

Problem: Design a Top-K Class for a Data Stream

You are given an unbounded stream of incoming elements. Design and implement a class that can report the current Top K elements at any time....

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: