leetle

Daily challenge for 2025-12-13

347. Count Negatives in Sorted Matrix

Given an m x n matrix grid sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid.

Example:
Input: grid = [[4,3,2,-1],[3,2,1,-1],[1,1,-1,-2],[-1,-1,-2,-3]]
Output: 8

Explanation: There are 8 negative numbers in the matrix.

Run this challenge interactively in Python or JavaScript when the app loads.