m × n board board: 0 marks a free cell and 1 an occupied one. You have an unlimited supply of identical rectangular stickers, each tall cells high and wide cells wide.
Stickers follow these rules:
- each sticker lies entirely on the board, aligned to the cells;
- stickers cannot be rotated;
- a sticker must not cover any occupied cell;
- stickers may overlap, and you may use as many as you like.
Return True if you can place stickers so that every free cell is covered, and False otherwise.board=[[0, 0, 0], [0, 0, 0], [1, 0, 0]], tall=2, wide=2 → True
Three 2×2 stickers with top-left corners at cells (0, 0), (0, 1) and (1, 1) together cover every free cell and miss the occupied one in the bottom-left corner.
board=[[0, 1, 0], [0, 0, 0]], tall=2, wide=2 → False
Every 2×2 sticker on this board touches the occupied cell in the middle of the top row, so no sticker fits, yet free cells remain.
board=[[1, 1], [1, 1]], tall=3, wide=3 → True
There are no free cells to cover, so the answer is True even though the sticker does not fit on the board at all.
board=[[0, 0, 0], [0, 0, 0], [1, 0, 0]], tall=2, wide=2
True
Run checks the first 3 tests in your browser. Submit checks all 84 tests on the server, hidden ones included.