12/28
Part 3 of 6 · The whole pageLearn and do

Titles past the screen block nothing

The most common slip in this problem is a line that looks careful. After a row is placed, it seems tidy to add all of its titles to shown. But only the head is on the screen. A title past the screen is something the viewer sees only after scrolling that row, so it must not stop a row below from showing it up front.

This is the line q-nfx-048 draws: global dedup for the first n positions, and only the row's own dedup after that.

Width 2: row 0's C is past the screen
right
row 0ABCrow 1CD
with the tail added to shown
row 0ABCrow 1D

Adding the whole row to shown blocks C in row 1, though the viewer never saw it. Row 1 shows D, and then nothing fits slot 1.

A test with no title shared between one row's tail and another row's head will never catch it. Most hand-made examples have none: they are written to show the dedup working, so the shared titles sit on the screen. That's why this task's tests build exactly that case, a title past the screen in one row and first in the next.

The code in the editor has this bug. Find the line in dedup_homepage that puts titles past the screen into shown, and fix it.