Binary Sudoku Error Checker
Statement
Goal
Binary Sudoku is a variant of Sudoku that only allows the numbers 0 and 1. The following three conditions must be met to pass:Each row and column must contain an equal number of 0s and 1s (5 each for a 10x10 grid).
No row or column may contain a sequence with more than two repeating digits (e.g. 1 1 0 is valid but 1 1 1 is invalid)
No rows (or columns) can be duplicates of other rows (or columns). (Note: you don't need to check columns against rows, only for duplicates amongst rows or columns separately)
Given a completed 10x10 binary grid of 0s and 1s (space-separated on each row), check if there are any errors.
If there are no errors print "Pass".
If there are errors, then print the first row or column that breaks one of the rules.
"First" here means in order of rows first, top to bottom, then columns, left to right.
Duplicate rows/columns are only counted as errors once they have appeared twice.
Input
10 lines : 10 rows of 10 space-separated 0s and 1s.
Output
"Pass" if the solution is valid or the first row/column to break one of the rules.
(If it was a column, print it as a space-separated row)
(If it was a column, print it as a space-separated row)
Constraints
All input grids will consist of 10 lines of 10 space-separated 0s and 1s.
No input will have a trailing newline after last row.
No input will have a trailing newline after last row.
Example
Input
1 1 0 1 1 0 1 0 0 0 0 0 0 1 1 1 0 1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 1 1 1 1 1 0 1 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0 1 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 0 1 0 0
Output
1 1 0 1 1 0 1 0 0 0
Game modes
Fastest, Shortest
Test cases
Test 1 Test
Input
1 1 0 1 1 0 1 0 0 0
0 0 0 1 1 1 0 1 1 0
1 0 0 0 1 0 1 0 0 0
0 0 0 1 1 0 1 0 0 0
1 0 1 1 1 1 1 0 1 1
0 0 1 1 0 0 0 0 0 1
1 0 1 0 1 1 1 0 0 1
0 0 0 1 0 0 1 1 0 0
1 1 0 1 0 0 1 1 0 1
1 1 1 0 1 1 0 1 0 0
Output
1 1 0 1 1 0 1 0 0 0
Validator 1 Validator
Input
1 0 1 0 0 1 0 1 0 1
0 0 0 1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