Number of Connected Components
Medium
Disjoint Set (Union-Find)
Given n nodes (0..n-1) and a list of undirected edges, print the number of connected components.
Constraints
1 <= n <= 2000 0 <= m <= 5000
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.