2025-12-28 16:38:30 +0300 MSK
Count Negative Numbers in a Sorted Matrix
Links
Code
class Solution:
def countNegatives(self, grid: List[List[int]]) -> int:
count = 0
for row in reversed(grid):
for col in reversed(row):
if col < 0:
count += 1
else:
break
return count