mirror of
https://github.com/aykhans/leet-code-problems.git
synced 2025-04-21 05:03:33 +00:00
added is_valid_sudoku
This commit is contained in:
parent
05b677c7f5
commit
30ce7fdc37
@ -81,6 +81,10 @@ class AcceptedMedium:
|
|||||||
|
|
||||||
def is_valid_sudoku(self, board: List[List[str]]) -> bool:
|
def is_valid_sudoku(self, board: List[List[str]]) -> bool:
|
||||||
# sourcery skip: list-comprehension, use-itertools-product
|
# sourcery skip: list-comprehension, use-itertools-product
|
||||||
|
"""
|
||||||
|
Link: https://leetcode.com/problems/valid-sudoku/
|
||||||
|
Runtime: 105 ms
|
||||||
|
"""
|
||||||
for i in board:
|
for i in board:
|
||||||
r = [j for j in i if j != '.' ]
|
r = [j for j in i if j != '.' ]
|
||||||
if len(set(r)) < len(r): return False
|
if len(set(r)) < len(r): return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user