335. Count Negative Numbers in a Sorted Matrix
Given a matrix grid with dimensions m x n, where the elements are sorted in non-increasing order both row-wise and column-wise, determine the number of negative numbers in the grid.
The input consists of two integers, m and n, on the first line, representing the dimensions of the matrix. The following m lines contain n integers each, representing the elements of the matrix.
Output a single integer, representing the count of negative numbers in the matrix.
4 4 4 3 2 -1 3 2 1 -1 1 1 -1 -2 -1 -1 -2 -3
m and n are the dimensions of the matrix grid, where m is the number of rows and n is the number of columns. The values of m and n are equal to the length of the grid array. The values of m and n are integers between 1 and 100, inclusive. The values of the elements in the grid array are integers between -100 and 100, inclusive.