Tap here to switch tabs
Problem
Ask
Submissions

Problem: Count Negative Numbers in a Sorted Matrix

easy
15 min
Explore methods to count negative numbers in a matrix sorted in non-increasing order by rows and columns. Understand the problem constraints and practice implementing solutions to improve your matrix traversal skills and coding interview readiness.

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

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Count Negative Numbers in a Sorted Matrix

easy
15 min
Explore methods to count negative numbers in a matrix sorted in non-increasing order by rows and columns. Understand the problem constraints and practice implementing solutions to improve your matrix traversal skills and coding interview readiness.

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