You are given a binary matrix grid with m rows and n columns. A cell value of
Two servers can communicate if they are located in the same row or in the same column. A server is considered communicating if it can communicate with at least one other server.
Return the total number of servers in grid that can communicate with at least one other server.
Constraints:
m == grid.length
n == grid[i].length
m
n
grid[i][j] == 0 or grid[i][j] == 1
You are given a binary matrix grid with m rows and n columns. A cell value of
Two servers can communicate if they are located in the same row or in the same column. A server is considered communicating if it can communicate with at least one other server.
Return the total number of servers in grid that can communicate with at least one other server.
Constraints:
m == grid.length
n == grid[i].length
m
n
grid[i][j] == 0 or grid[i][j] == 1