Pick the fix
When should the window shrink?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A When its length minus its top colour count is more than k
Right: that many tiles would need repainting, more than allowed.
The test counts the tiles that are not the majority colour, since those are the ones you would repaint.
Why not the others?
- B When it contains more than one colour. Mixed colours are fine as long as repaints cover the minority tiles.
- C When its length is more than k. Long windows are the goal; only the number of minority tiles matters.