Given a city connection matrix, count the groups of directly or indirectly connected cities — with DFS and with Union-Find.
Given a city connection matrix, count the groups of directly or indirectly connected cities — with DFS and with Union-Find.
Opens with the full question.