Skip to content

[FEATURE REQUEST] Add Sudoku Solver using Backtracking #6929

@Shewale41

Description

@Shewale41

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions