Search
⌘K

Leetcode 1351. Count Negative Numbers in a Sorted Matrix

Given an m x n matrix sorted in non-increasing order both row- and column-wise, return the number of negative entries; exploit the matrix's monotonicity to skip blocks of non-negative values and achieve an O(m + n) scan.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.