text: class Solution:
      def countServers(self, grid: List[List[int]]) -> int:
          """Array.
  
          Running time: O(m * n) where m and n are the size of grid.
          """
          m, n = len(grid), len(grid[0])
          row, col = [0] * m, [0] * n
          for i in range(m):
              for j in range(n):
                  if grid[i][j] == 1:
                      row[i] += 1
                      col[j] += 1
          res = 0
          for i in range(m):
              for j in range(n):
                  if grid[i][j] == 1 and (row[i] > 1 or col[j] > 1):
                      res += 1
          return res
  