1351. Count Negative Numbers in a Sorted Matrix

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1351

class Solution:
    def countNegatives(self, grid: List[List[int]]) -> int:
        return sum(bisect_left(row[::-1], 0) for row in grid)