← 返回 bytedance 的题目列表Real-Time Top-K Most Listened Songs Data Structure Design
类型:online_judge
bytedance
You are developing a music streaming application and need to implement a data structure to maintain and return the top K most-listened-to songs in real-time. Assume there are 100 million daily active users (DAU), and the system must be efficiently designed to handle data streams of this scale. Please describe in detail the required data structure and algorithm solution, considering performance optimization for large-scale data.
Example
Input
3
50 song_1
30 song_2
40 song_3
60 song_4