Count Zeros In A Sorted Matrix

easy
1. You are given a NxN binary matrix A where each row and column of the matrix is sorted in ascending order.
 2. You have to find the count of zeros in this matrix.
 3. For example,
 Input: 
 {
     {0,0,0},
     {0,0,1},
     {0,1,1}
 }
 
 Output: 6
 
 Note:
 1. main takes input from the users.
 2. display is a utility function that displays a matrix. Feel free to use it for debugging purposes.
 3. This is a functional problem.
 4. You have to complete the function countZeroes. It takes as input the given matrix and N. It should return the required count.

Input Format

First line takes input N, the size of the given matrix. Next N lines takes input N space separated 0s or 1s representing the elements of the matrix. Input is handled for you.

Output Format

The required count. Output is handled for you.

Constraints

N/A

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 0 
0 0 1 
0 1 1
Output
6
Previous
Count The Triplets
Next
Distinct Absolute Array Elements

Related Questions