← ALL NOTES
Depth-First Search

547. Number of Provinces

Given an adjacency matrix of city connections, count the provinces — groups of directly-or-indirectly connected cities. Connectivity is transitive, which is the exact signature of a…

Loading…