forked from code-clash/sudoku-verifier
38 lines
821 B
Markdown
38 lines
821 B
Markdown
# Sudoku verifier
|
||
|
||
## Definition
|
||
Sudokus are logic number puzzles in which cells in a 9×9 grid must be populated with
|
||
the digits 1 to 9 in a way that each digit occurrs only once in each unit (that is column,
|
||
row or block = 3×3 sub grid).
|
||
|
||

|
||
|
||
## Goal
|
||
Validate if a given solution for a Sudoku is valid, by checking that the digit
|
||
1 to 9 appear only once in column, in each row and in each of the 9 sub grids.
|
||
|
||
### Input
|
||
a sequence of 81 digits, organized in 9 columns and 9 rows
|
||
|
||
### Output
|
||
A boolean value, if the grid is valid.
|
||
|
||
### Constraints
|
||
1 <= `digit` <= 9
|
||
|
||
### Examples
|
||
**Input:**
|
||
```
|
||
9 8 1 5 2 3 6 4 7
|
||
6 3 4 8 7 9 2 5 1
|
||
2 7 5 1 4 6 9 8 3
|
||
1 9 6 4 8 7 5 3 2
|
||
5 4 8 3 1 2 7 6 9
|
||
7 2 3 6 9 5 4 1 8
|
||
3 1 2 7 5 4 8 9 6
|
||
4 6 9 2 3 8 1 7 5
|
||
8 5 7 9 6 1 3 2 4
|
||
```
|
||
**Output:**
|
||
`true`
|