Skip to content

Commit

Permalink
Time: 164 ms (32.42%), Space: 16.7 MB (33.33%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
hovanhoa committed Dec 13, 2023
1 parent 24aa785 commit 91807d8
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Solution:
def numSpecial(self, mat: List[List[int]]) -> int:
ans = 0
m = len(mat)
n = len(mat[0])

for row in range(m):
for col in range(n):
if mat[row][col] == 0:
continue

good = True
for r in range(m):
if r != row and mat[r][col] == 1:
good = False
break

for c in range(n):
if c != col and mat[row][c] == 1:
good = False
break

if good:
ans += 1

return ans

0 comments on commit 91807d8

Please sign in to comment.