1/30
Part 1 of 7 · Score orderLearn

Movie billboard rotation

Netflix software engineer candidates report this coding round, in an onsite (1 report) and in a data platform loop, where the candidate called it a known question from other reports (1 report). A prep site lists a version of it for ML engineers too (1 source). It starts like this:

The home page has one billboard, and it shows one title at a time. You get the catalog as a dict from title to score. Write a class Billboard(scores) with a method get() that returns the next title to show. Show the best score first. Every title shows once before any title shows again, and then the loop starts over. Break a tie by title, in alphabetical order. With no titles, return None.

Catalogget(), called seven times
{"Orbit": 5, "Maple": 7, "Comet": 9, "Tundra": 3, "Harbor": 7}Comet, Harbor, Maple, Orbit, Tundra, Comet, Harbor
{}None every time

Then the scores change while the billboard runs. update(title, score) has to count at once, and a title already shown in this loop waits for the next one (1 report). After that comes the rule the prep site's version names: no immediate repeats (1 source). An update can make the last title of one loop the best one of the next, and the billboard must not show it twice in a row. The last level stretches that into a cooldown of k calls.

You don't write it yet. The lesson first teaches the pieces: a sort with an exact tie-break, a loop that keeps its place, two sorted lists that survive updates, and why a heap makes updates hard. At the end you solve the whole problem, level by level, in an interview simulation with a 45-minute timer.

This lesson builds on sorting with tie-breaks, from the database lesson, and on the heaps lesson: the billboard is a ranking that has to keep changing while it runs.