A simple yet powerful Sudoku solver built in Python using the backtracking algorithm.
It checks all possible numbers for each empty cell and backtracks when a number leads to a dead end β continuing recursively until the puzzle is solved.
-
Row & Column Validation:
Checks if the chosen number already exists in the same row or column. -
3x3 Subgrid Validation:
Calculates the top-left corner of each 3x3 box and ensures no duplicates exist. -
Backtracking Algorithm:
- Tries placing numbers 1β9 in each empty cell.
- If a valid placement leads to a full solution, it returns
True. - Otherwise, it resets the cell to
0and tries the next number.