Bomber Man
You are given a two-dimensional integer matrix of 1s and 0s, where a 1 represents a bomb and 0 represents an empty cell. When a bomb explodes, all the spaces along on the same row and column are damaged. Return the number of spaces you can stand in to not get damaged.
Constraints
n * m ≤ 200,000wherenandmare the number of rows and columns inmatrix.
https://binarysearch.com/problems/Bomber-Man
Examples
Example 1
Input
- matrix =
[[1,0,0],
[0,1,0],
[0,0,0]]
Output
- answer =
1
Explanation
Only the bottom right cell is safe
Leave a comment