Check if Every Row and Column Contains All Numbers LeetCode solution in Python

1
class Solution:
2
def checkValid(self, matrix: List[List[int]]) -> bool:
3
lst = [0] * len(matrix)
4
for i in matrix:
5
if len(set(i)) != len(matrix):
6
return False
7
for j in range(len(i)):
8
lst[j] += i[j]
9
return len(set(lst)) == 1

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0