Fill the empty cells one at a time with the smallest digit that does not clash with its row, column or box. When a cell has no digit left, an earlier guess was wrong: go back to the previous cell, erase it and try its next digit.
- Average time
- O(9^m)
- Space
- O(n²)