Correct code. Two hours late.
transcript
This report is correct. And it is two hours late. Every night. Let us count why.
Find every replay of a mix. Any order, back to back. Window one. Two, seven, seven. A replay. Count the next window from scratch. Then the next. Eight plays? Instant. The team keeps it as the reference.
Now the real report. 14,400 plays per channel. A mix of a hundred tracks. Ten thousand channels. Fifty mixes. Half a million pairs.
Every window, counted from scratch. That is 715 billion count updates. At a hundred million a second, that is two hours. The deadline is one hour.
Here is the catch. Neighbouring windows share all but one play. The first attempt counts those plays again and again. So lower the leaver's count. Raise the joiner's count. Two updates per move. About two and a half minutes.
Correct code is where you start. Then count the work. Then remove the repeats.
Full breakdown in the lecture.