Opening your workspace…
Workspace/Coding room
Opening your workspace…
At Tetris practice, the next blocks are waiting their turn—but this board is for a special drill: it accepts only identical two-cell blocks. The board is represented by board, a rectangle of rows. Each . is an open square, and each # is a locked square that blocks placement.
Place blocks to cover every open square exactly once. A block covers two adjacent squares, either horizontally or vertically. Count the distinct complete arrangements, modulo 1000000007. The blocks are identical, so swapping two blocks does not create a new arrangement. If there are no open squares, there is one complete arrangement.
["...","..."]Output3Three vertical blocks fit, or two horizontal blocks fit alongside one vertical block at either end.
[".#",".."]Output0Three open squares cannot be covered in pairs.
Track which squares in the next row are already occupied by vertical blocks.
function solve(board) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.
["...","..."]3