Count Negative Numbers in a Sorted Matrix

Easy · Binary Search · about 10 minutes

Asked at Amazon, Google, Apple, Microsoft.

An m × n matrix is sorted in non-increasing order along both rows and columns. Return the number of negative numbers in O(m + n).

Related guides