Skip to content

Commit 39a67e0

Browse files
Update algorithms/matrix/isvalidsudoku/__init__.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 98018a8 commit 39a67e0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

algorithms/matrix/isvalidsudoku/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def is_valid_sudoku(board: List[List[str]]) -> bool:
1616
if len(board) != 9:
1717
return False
1818

19+
# Validate each row has exactly 9 columns
20+
if any(len(row) != 9 for row in board):
21+
return False
22+
1923
number_of_rows = len(board)
2024
number_of_columns = len(board[0])
2125
row_sets: List[Set[str]] = [set() for _ in range(number_of_rows)]

0 commit comments

Comments
 (0)