Connected Groups

Given an N × N character matrix related, where:

  • related[i][j] == '1' means entity i is directly connected to entity j;
  • related[i][j] == '0' means they are not directly connected.

The...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: