grid. Each cell holds a digit from '1' to '9' or a dot '.', which marks an empty cell.
Fill in every empty cell so that:
- each row contains every digit from 1 to 9 exactly once;
- so does each column;
- and so does each of the nine 3 × 3 squares the board is split into.
Return the filled board. The board is guaranteed to have exactly one solution.grid=[['.', '.', '.', '9', '7', '2', '.', '8', '5'], ['.', '.', '2', '.', '.', '.', '6', '.', '4'], ['.', '.', '.', '.', '.', '.', '3', '.', '.'], ['.', '8', '.', '.', '9', '.', '.', '5', '.'], ['4', '5', '.', '2', '.', '3', '.', '7', '6'], ['.', '7', '.', '.', '6', '.', '.', '1', '.'], ['.', '.', '6', '.', '.', '.', '.', '.', '.'], ['9', '.', '5', '.', '.', '.', '2', '.', '.'], ['8', '2', '.', '6', '1', '4', '.', '.', '.']] → [['3', '6', '4', '9', '7', '2', '1', '8', '5'], ['7', '1', '2', '3', '5', '8', '6', '9', '4'], ['5', '9', '8', '1', '4', '6', '3', '2', '7'], ['6', '8', '3', '7', '9', '1', '4', '5', '2'], ['4', '5', '1', '2', '8', '3', '9', '7', '6'], ['2', '7', '9', '4', '6', '5', '8', '1', '3'], ['1', '3', '6', '5', '2', '9', '7', '4', '8'], ['9', '4', '5', '8', '3', '7', '2', '6', '1'], ['8', '2', '7', '6', '1', '4', '5', '3', '9']]
In the returned board every dot is replaced by a digit, and each row, column and 3 × 3 square holds the digits 1 to 9 without repeats.
grid=[['.', '.', '.', '9', '7', '2', '.', '8', '5'], ['.', '.', '2', '.', '.', '.', '6', '.', '4'], ['.', '.', '.', '.', '.', '.', '3', '.', '.'], ['.', '8', '.', '.', '9', '.', '.', '5', '.'], ['4', '5', '.', '2', '.', '3', '.', '7', '6'], ['.', '7', '.', '.', '6', '.', '.', '1', '.'], ['.', '.', '6', '.', '.', '.', '.', '.', '.'], ['9', '.', '5', '.', '.', '.', '2', '.', '.'], ['8', '2', '.', '6', '1', '4', '.', '.', '.']] → [['3', '6', '4', '9', '7', '2', '1', '8', '5'], ['7', '1', '2', '3', '5', '8', '6', '9', '4'], ['5', '9', '8', '1', '4', '6', '3', '2', '7'], ['6', '8', '3', '7', '9', '1', '4', '5', '2'], ['4', '5', '1', '2', '8', '3', '9', '7', '6'], ['2', '7', '9', '4', '6', '5', '8', '1', '3'], ['1', '3', '6', '5', '2', '9', '7', '4', '8'], ['9', '4', '5', '8', '3', '7', '2', '6', '1'], ['8', '2', '7', '6', '1', '4', '5', '3', '9']]
grid has 9 rows of 9 cells'1' to '9' or '.'grid=[['.', '.', '.', '9', '7', '2', '.', '8', '5'], ['.', '.', '2', '.', '.', '.', '6', '.', '4'], ['.', '.', '.', '.', '.', '.', '3', '.', '.'], ['.', '8', '.', '.', '9', '.', '.', '5', '.'], ['4', '5', '.', '2', '.', '3', '.', '7', '6'], ['.', '7', '.', '.', '6', '.', '.', '1', '.'], ['.', '.', '6', '.', '.', '.', '.', '.', '.'], ['9', '.', '5', '.', '.', '.', '2', '.', '.'], ['8', '2', '.', '6', '1', '4', '.', '.', '.']]
[['3', '6', '4', '9', '7', '2', '1', '8', '5'], ['7', '1', '2', '3', '5', '8', '6', '9', '4'], ['5', '9', '8', '1', '4', '6', '3', '2', '7'], ['6', '8', '3', '7', '9', '1', '4', '5', '2'], ['4', '5', '1', '2', '8', '3', '9', '7', '6'], ['2', '7', '9', '4', '6', '5', '8', '1', '3'], ['1', '3', '6', '5', '2', '9', '7', '4', '8'], ['9', '4', '5', '8', '3', '7', '2', '6', '1'], ['8', '2', '7', '6', '1', '4', '5', '3', '9']]
Run checks the first 3 tests in your browser. Submit checks all 30 tests on the server, hidden ones included.