20/28
Part 5 of 6 · The worked exampleLearn and do
A worked example: each title at most m times on the screen
A related question, worked the way a candidate should take it: allow each title on the first screen up to m times, not once. A product team might want that for a big launch, shown in a few rows on purpose.
1. Say the rules back.
m = 1is level 1, so the old tests are tests of this too.- A row still never shows a title twice, whatever
mis. - Titles past the screen still don't count.
- A slot nothing fits still ends the row.
2. Write the checker before the code. It is short, it is obviously right, and it tells you whether any output is legal: count the titles in row[:width] over the page, and check that no count passes m and no row repeats itself.
Width 1, m = 2. The output is A, B / A, C / A, D. Does it obey the cap?
Pick an answer above to see the rest