A listener opens a music app and starts song_101. Its listener count increases by one. A few minutes later, that listener switches to song_202: the first song loses a listener and the second gains one. A popular-songs widget needs to reflect those changes and return the K songs with the most listeners.
Design a service that returns the most-played songs over the last five minutes. Each accepted playback adds one to a song’s count. Results update once per second and include the songs’ play counts and the time interval they cover.
Leave a Comment