floor: '1' is a white tile and '0' is a black one.
You have rugs dark rugs, and each covers exactly rug_length consecutive tiles. Rugs may be placed anywhere, overlapping included.
Place the rugs so that as few white tiles as possible stay visible, and return that number.floor='1101101', rugs=1, rug_length=3 → 3
There are five white tiles, and any stretch of three tiles covers at most two of them. 3 stay visible.
floor='111011', rugs=2, rug_length=2 → 1
Lay the rugs over tiles 1–2 and 4–5; only the white tile 0 remains uncovered.
floor='1001', rugs=2, rug_length=1 → 0
Each rug covers one of the two white tiles.
rug_length ≤ floor.length ≤ 1000floor[i] is '0' or '1'rugs ≤ 1000floor='1101101', rugs=1, rug_length=3
3
Run checks the first 3 tests in your browser. Submit checks all 111 tests on the server, hidden ones included.