-
Notifications
You must be signed in to change notification settings - Fork 20.8k
Description
What would you like to Propose?
Title: Add Sudoku Solver using Backtracking
🧠 Overview
I’d like to contribute a Sudoku Solver algorithm using the Backtracking technique. This algorithm systematically explores all valid placements of digits in a 9×9 Sudoku grid until it finds a valid solution that satisfies all Sudoku constraints.
🧩 Problem Description
Given a partially filled 9×9 Sudoku board, fill all empty cells (represented by 0) such that every row, column, and 3×3 subgrid contains the digits 1 through 9 exactly once.
📂 Implementation Details
- Folder:
src/main/java/com/thealgorithms/backtracking/ - Filename:
SudokuSolver.java - Approach: Depth-first backtracking algorithm that tries valid numbers recursively and backtracks on invalid placements.
✅ Expected Deliverables
- Clean, modular implementation (e.g.,
isValid(),solveSudoku()methods). - Example
main()method demonstrating functionality. - Unit tests validating correctness on solvable and unsolvable grids.
- Clear in-code documentation and time complexity notes.
🧑💻 Additional Notes
Backtracking is one of the most intuitive ways to solve Sudoku and a great educational addition to the repository. I have a working version ready and would like to open a PR once this issue is approved.
Issue details
🧩 Problem Description
Given a partially filled 9×9 Sudoku board, fill all empty cells (represented by 0) such that every row, column, and 3×3 subgrid contains the digits 1 through 9 exactly once.
Additional Information
No response