Given n cities, some are directly connected, and others are not. You are given an n×n matrix called cities, where cities[i][j]=1 means city ith and city jth are directly connected, and cities[i][j]=0 ...
⋮
Tap here to switch tabs
Problem
Ask
Submissions
Solution
Solution: Number of Provinces
Statement▼
Given n cities, some are directly connected, and others are not. You are given an n×n matrix called cities, where cities[i][j]=1 means city ith and city jth are directly connected, and cities[i][j]=0 ...