Java icon indicating copy to clipboard operation
Java copied to clipboard

[FEATURE REQUEST] Add Sudoku Solver using Backtracking

Open Shewale41 opened this issue 1 month ago • 2 comments

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

Shewale41 avatar Oct 25 '25 13:10 Shewale41