Number of Provinces
Medium
Disjoint Set (Union-Find)
Given an n x n matrix isConnected where isConnected[i][j] = 1 means city i and city j are directly connected, print the number of provinces (groups of directly or indirectly connected cities).
Constraints
1 <= n <= 200
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.