Count Zeros In A Sorted Matrix

easy
Given a Binary Square Matrix where each row and column of the matrix is sorted in ascending order. Find the total number of Zeros present in the matrix.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1 <= T <= 50
1 <= M,N <= 1000
0 <= A[i][j] <= 1

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
3 
0 0 1
0 1 1
0 1 1
Output
4
Previous
Count Possible Triangles
Next
Counting Elements In Two Arrays

Related Questions