LeetCode/NeetCodeRoadmap/Arrays_and_Hashing/36_Valid_Sudoku.py
2023-08-25 21:37:26 -07:00

24 lines
691 B
Python

def isValidSudoku(board):
"""
:type board: List[List[str]]
:rtype: bool
"""
temp = []
for x in range(len(board)):
for y in range(len(board[x])):
if y not in temp:
temp.append(board[x])
else:
return False
return True
print(isValidSudoku([["5","3",".",".","7",".",".",".","."]
,["6",".",".","1","9","5",".",".","."]
,[".","9","8",".",".",".",".","6","."]
,["8",".",".",".","6",".",".",".","3"]
,["4",".",".","8",".","3",".",".","1"]
,["7",".",".",".","2",".",".",".","6"]
,[".","6",".",".",".",".","2","8","."]
,[".",".",".","4","1","9",".",".","5"]
,[".",".",".",".","8",".",".","7","9"]]))