FastPrepScore-Rotating Movie Playlist
Problems/Score-Rotating Movie Playlist

Score-Rotating Movie Playlist

Netflix logoNetflix● HardFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report requires score updates, prohibits a movie from repeating until the current cycle is exhausted, and then begins another cycle. The operation batch preserves those state transitions and per-GET outputs.

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.

More Netflix problems

  • Timed Cache with Sidecar CleanupPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Repeated Titles in Viewing HistoryPHONE SCREEN · Seen Sep 2026
  • Capacity-Limited Timed CachePHONE SCREEN · Seen Sep 2026
All Netflix interview questionsSee Netflix hiring insights
Saved
class Solution {
    public String[] rotateMoviePlaylist(String[] movies, int[] scores, String[][] operations) {
        // Write your solution here.
    }
}
Checking account…