Question
Suduko Solving
You are given a partially filled 9x9 Sudoku board. Your task is to fill in the empty cells so that the board becomes a valid Sudoku solution.
Write a program to solve the Sudoku puzzle by filling the empty cells with digits ('1' to '9').
A valid sudoku solution must satisfy all of the following rules:
- Each of the digits
1-9must occur exactly once in each row. - Each of the digits
1-9must occur exactly once in each column. - Each of the digits
1-9must occur exactly once in each of the 93x3sub-boxes of the grid.
'1' to '9'), and others are empty, marked with the character '.'.
Note:
- It is guaranteed that each input board has exactly one valid solution.
Input
As this is a functional problem, your task is to implement the function
You must fill in the empty cells (denoted by
Custom Input
To test your function locally, read the board as 9 lines of input, where each line is a string of exactly 9 characters:
Digits
The dot
solveSudoku, which takes a 9x9 2D character array board representing a partially filled Sudoku board.
You must fill in the empty cells (denoted by
'.') such that the final board is a valid Sudoku solution.
Custom Input
To test your function locally, read the board as 9 lines of input, where each line is a string of exactly 9 characters:
Digits
'1' to '9' represent pre-filled cells.
The dot
'.' represents an empty cell.Output
As this is a functional problem, you are not required to return or print anything from your function.
The solution will be verified based on in-place modifications made to the original
The solution will be verified based on in-place modifications made to the original
9×9 2D character array board representing the Sudoku board.
Example
Sample Input:
53..7....
6..195...
.98....6.
8...6...3
4..8.3..1
7...2...6
.6....28.
...419..5
....8..79
Sample Output:
534678912
672195348
198342567
859761423
426853791
713924856
961537284
287419635
345286179
Explanation: The image below depicts the only valid solution for the input sudoku puzzle.

53..7....
6..195...
.98....6.
8...6...3
4..8.3..1
7...2...6
.6....28.
...419..5
....8..79
Sample Output:
534678912
672195348
198342567
859761423
426853791
713924856
961537284
287419635
345286179
Explanation: The image below depicts the only valid solution for the input sudoku puzzle.
