0%
1 2 3 4 5 6 7 8 9 10 11 12 13
| class Solution: def countNegatives(self, grid: List[List[int]]) -> int: m = len(grid)-1 n = len(grid[0])-1 negative_num = 0 for i in range(m,-1,-1): for j in range(n,-1,-1): if grid[i][j] < 0: negative_num += 1 else: break return negative_num
|