Given a graph with V vertices. Find the number of Provinces.
Note: A province is a group of directly or indirectly connected cities and no other cities outside of the group.
- Time : O(v^2logv)
- Space : O(v)
1 | class Solution { |
Given a graph with V vertices. Find the number of Provinces.
Note: A province is a group of directly or indirectly connected cities and no other cities outside of the group.
1 | class Solution { |