Problem
Ask
Submissions

Problem: Count Negative Numbers in a Sorted Matrix

Easy
15 min
Explore how to find and count all negative numbers in a sorted matrix where rows and columns are ordered non-increasingly. Learn to apply efficient traversal methods to solve this problem, understand constraints, and implement solutions suitable for coding interviews.

Statement

Given a matrix grid of size m  nm \ * \ n, where each row and column is sorted in non-increasing order, find and return the total count of negative numbers in the matrix.

Constraints:

  • mm ==== grid.length

  • nn ==== grid[i].length

  • 11\leq mm, nn 1000\leq 1000

  • 100-100 \leq grid[i][j] 100\leq 100

Problem
Ask
Submissions

Problem: Count Negative Numbers in a Sorted Matrix

Easy
15 min
Explore how to find and count all negative numbers in a sorted matrix where rows and columns are ordered non-increasingly. Learn to apply efficient traversal methods to solve this problem, understand constraints, and implement solutions suitable for coding interviews.

Statement

Given a matrix grid of size m  nm \ * \ n, where each row and column is sorted in non-increasing order, find and return the total count of negative numbers in the matrix.

Constraints:

  • mm ==== grid.length

  • nn ==== grid[i].length

  • 11\leq mm, nn 1000\leq 1000

  • 100-100 \leq grid[i][j] 100\leq 100