Question: I need to see how this code looks. Thank you. A Sudoku puzzle is a 9x9 grid partially filled with digits from 1 to 9
I need to see how this code looks. Thank you.
A Sudoku puzzle is a 9x9 grid partially filled with digits from 1 to 9 inclusive. To solve a puzzle, a player must fill the empty squares of the grid so that each row, each column, and each of the nine 3x3 boxes contains every digit from 1 to 9. That is, no row, column, or box contains a duplicate digit. A possible solution is shown below.
Write a program that reads a 9x9 grid of digits and determines whether or not the grid is a solution to a
Sudoku puzzle.
Hint: Use a 2D array to solve this problem.
Hint: Define a separate function which accepts nine integers and returns whether or not they are unique.
Then, repeatedly use this function.
| 4 | 2 | 9 | 8 | 1 | 3 | 5 | 6 | 7 |
| 5 | 1 | 6 | 4 | 7 | 2 | 9 | 3 | 8 |
| 7 | 8 | 3 | 6 | 5 | 9 | 2 | 4 | 1 |
| 6 | 7 | 2 | 1 | 3 | 4 | 8 | 5 | 9 |
| 3 | 9 | 5 | 2 | 8 | 6 | 1 | 7 | 4 |
| 8 | 4 | 1 | 7 | 9 | 5 | 6 | 2 | 3 |
| 1 | 5 | 8 | 3 | 6 | 7 | 4 | 9 | 2 |
| 9 | 3 | 4 | 5 | 2 | 8 | 7 | 1 | 6 |
| 2 | 6 | 7 | 9 | 4 | 1 | 3 | 8 | 5 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
