Problem of the day
You are given ‘N’ = 3, ‘M’ = 2 and ‘MAT’= [[3, 1],[2, -1],[1, 2]]. Then the answer will be two for the first test case because there are two negative numbers in the given matrix(-1, -2).
The first line of the input contains a single integer 'T', representing the number of test cases.
The first line of each test case contains two space-separated integers, ‘N’ and ‘M’, representing the number of rows and columns in ‘MAT’, respectively.
The next ‘N’ lines contain ‘M’ space-separated integers representing the elements of ‘MAT’.
For each test case, print the number of negative numbers in ‘MAT’.
Print the output of each test case in a separate line.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 5000
1 <= M <= 5000
-10^6 <= MAT[i][j] <= 10^6
Time Limit: 1 sec
2
3 2
3 1
2 -1
1 -2
3 3
3 2 1
0 -1 -2
-3 -4 -5
2
5
For the first test case, the answer will be two for the first test case because there are two negative numbers in the given matrix(-1, -2).
For the second test case, the answer will be five because there are five negative numbers in the given matrix(-1, -2, -3, -4, -5).
2
2 2
3 -1
2 -1
2 2
1 1
1 1
2
0