Question Details
Problem You are given a list of play events (user_id, song_id). For each user, return the top k most-played songs (by play count), breaking ties by song_id ascending. Return a dictionary mapping each user to their ranked list. Follow-ups How would you use a heap to get top-k without fully sorting the song list per user? If the event stream is very large (billions of entries), how would you compute this with a distributed map-reduce approach? How would you handle a sliding window: top-k songs pla…
Full Details
🔒
Unlock all Spotify questions
Full insider details, leaked discussions, and candidate experiences.
Get full access — $100 a year, unlimited accessAbout This Question
This is a reported interview question from a spotify interview during the onsite round.
It covers the following topics: Heap, Sliding Window, System Design, Coding, Onsite .