Problem statement

https://binarysearch.com/problems/Bomber-Man/

Solution

Find number of full zero rows and multiply it by number of full zero columns.

Complexity

It is O(mn) for time and O(1) for space.

Code

class Solution:
    def solve(self, M):
        m, n = len(M), len(M[0])
        r = sum(all(i == 0 for i in row) for row in M)
        c = sum(all(i == 0 for i in col) for col in zip(*M))
        return r * c