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
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.