Search⌘ K
AI Features

Solution: Count Servers that Communicate

C# solution for the Count Servers that Communicate problem using the Hash Maps pattern.

Statement

You are given a binary matrix grid with m rows and n columns. A cell value of 11 represents a server, and a cell value of 00 represents an empty cell.

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

  • 11 \leq ...