Count Negative Numbers in Grid
Easy
Arrays
Array
Binary Search
Matrix
Given m×n sorted grid, count negative numbers.
Constraints
m,n ≤ 100
Examples
Example 1:
Input: 4 3 2 -1
3 2 1 -1
1 1 -1 -2
-1 -1 -2 -3
Output: 8
Example 2:
Input: 3 2
1 0
Output: 0
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console