Score-Rotating Movie Playlist
Reported by candidates from Netflix's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Netflix reportedly put this playlist problem in front of candidates in September 2026, and the constraints are the whole story. Up to 100000 movies and 200000 operations means you can't re-sort or scan the list on every GET. It's a design problem in disguise: an ordered structure with updates, plus a cycle reset that has to be cheap. If you've got the OA in a day or two, learn the shape of the solution now. And if you blank mid-assessment, StealthCoder runs invisibly as a safety net while you work.
The problem
Maintain a movie playlist with mutable integer scores. Process an ordered batch of operations: ["GET"] returns the highest-scored movie that has not yet been returned in the current cycle. ["UPDATE", movie, score] replaces an existing movie's score and returns nothing. Break score ties by lexicographically smaller movie title. After every movie has been returned once, the next GET starts a new cycle in which all movies are eligible again. An update changes ordering immediately but does not make a movie eligible again inside a cycle where it was already returned. Return the titles produced by the GET operations in order. Function rotateMoviePlaylist(movies: String[], scores: int[], operations: String[][]) → String[] Examples Example 1 movies = ["A","B","C"] scores = [9,7,8] operations = [["GET"],["GET"],["GET"],["GET"]] return = ["A","C","B","A"] Every movie appears once before the cycle resets. Example 2 movies = ["A","B","C"] scores = [5,4,3] operations = [["GET"],["UPDATE","C","10"],["UPDATE","A","20"],["GET"],["GET"],["GET"]] return = ["A","C","B","A"] A remains exhausted despite its update; C moves ahead of B. A becomes eligible when the next cycle begins. Example 3 movies = ["Beta","Alpha"] scores = [4,4] operations = [["GET"],["GET"]] return = ["Alpha","Beta"] Lexicographic order breaks equal-score ties. Constraints 1 <= movies.length == scores.length <= 100000. Movie titles are unique non-empty ASCII strings of length at most 100. -10^9 <= score <= 10^9. 0 <= operations.length <= 200000. Every update names an existing movie and every operation has the stated shape.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is a priority structure keyed by (score descending, title ascending) that holds only the eligible movies. GET pops the top and marks that movie as used. UPDATE has two cases. If the movie is still eligible, remove its old entry and insert the new one. If it's already used, just store the new score so it's right when the cycle resets. Use a heap with lazy deletion (version stamps per movie) or a sorted set with real removal. When the eligible set empties, rebuild it from all current scores in O(n), which amortizes fine since a rebuild only happens after n GETs. The classic pitfall is making an updated, already-returned movie eligible again mid-cycle, which Example 2 tests directly. Another is forgetting the title tie-break. StealthCoder is your hedge in the live OA if the lazy-deletion bookkeeping slips away from you.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Score-Rotating Movie Playlist cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Netflix's OA.
Netflix reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Score-Rotating Movie Playlist FAQ
What's the core trick in the Netflix score-rotating playlist problem?+
Keep an ordered structure of only the eligible movies, sorted by score descending then title ascending. GET pops the top. When it empties, rebuild from the current scores. Updates to used movies only change the stored score, not the eligible set.
Why does brute force fail here?+
With 100000 movies and 200000 operations, scanning or sorting on every GET is roughly 10^10 work or worse. You need O(log n) per operation, so a heap or balanced ordered set is required.
How do I handle UPDATE on a movie that's already been returned?+
Just overwrite its score in your map. Don't put it back into the eligible structure. It becomes eligible again only when the next cycle starts and you rebuild from the current scores, exactly as Example 2 shows.
Heap or sorted set, which should I use?+
Either works. A heap needs lazy deletion, where each entry carries a version and stale entries get skipped on pop. A sorted set supports direct removal and reinsertion, which is simpler to reason about if your language has one.
How do I prep for this in 48 hours?+
Write the lazy-deletion heap version once from scratch and test it on the three examples. Then try edge cases: a single movie, equal scores with different titles, an update right before a cycle reset, and zero operations.