Input: matrix = [[2,2,3,4,5,6,7,8,9],[4,5,6,7,8,9,1,2,3],[7,8,9,1,2,3,4,5,6],[2,3,4,5,6,7,8,9,1],[5,6,7,8,9,1,2,3,4],[8,9,1,2,3,4,5,6,7],[3,4,5,6,7,8,9,1,2],[6,7,8,9,1,2,3,4,5],[9,1,2,3,4,5,6,7,8]]
Output: false
Explanation: The first row now has two 2s and no 1, so it is no longer a valid row (and the top-left box is also broken the same way).
Example 3
Input: matrix = [[1,2,3,4,5,6,7,8,9],[2,3,4,5,6,7,8,9,1],[3,4,5,6,7,8,9,1,2],[4,5,6,7,8,9,1,2,3],[5,6,7,8,9,1,2,3,4],[6,7,8,9,1,2,3,4,5],[7,8,9,1,2,3,4,5,6],[8,9,1,2,3,4,5,6,7],[9,1,2,3,4,5,6,7,8]]
Output: false
Explanation: Every row and every column here contains each digit exactly once, but the top-left 3x3 box has values 1,2,3,2,3,4,3,4,5, which repeats 2, 3, and 4 while missing 6, 7, 8, and 9.
Constraints
matrix.length == 9
matrix[i].length == 9 for every row i
1≤matrix[i][j]≤9
Loading editor...
Run checks the sample cases; Submit runs every case.
Samples 3
Custom 0
passedwrong answertime limiterrorran, no expected valuenot run