> For the complete documentation index, see [llms.txt](https://emmaguo100.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emmaguo100.gitbook.io/leetcode/08-05-2022-37.-sudoku-solver.md).

# 08/05/2022 37. Sudoku Solver

Method: use backtrack. The most difficult part that I think is how to verify the number filled in the cell is valid for its sub-grid. The basic idea is to iterate through the board, if the cell is '.', then we try the number from 1 to 9, if the number is valid, then we recursively call the backtrack method again and if it returns true, we finish our task. Otherwise, we need reset the current cell to '.' After try the number from 1 to 9 and if there is still no valid answer, we need to return false. Otherwise, return true.&#x20;

Time O(9 ^(9×9) )

Space O(1)
