2025-07-25 12:29:53 +0300 MSK
Count Negative Numbers in a Sorted Matrix
Links
Code
class Solution:
def countNegatives(self, grid: List[List[int]]) -> int:
count = 0
for i, row in enumerate(grid):
for j, num in enumerate(row):
if num < 0:
count += len(row) - j
break
return count