Given n cities, some are connected directly while others indirectly. A province is a group of directly or indirectly connected cities, and no cities outside the group. You are provided an n x n matrix isConnected where isConnected[i][j] = 1 if cities i and j are directly connected, and isConnected[i][j] = 0 otherwise. Determine the total number of provinces.
Click Run to execute sample tests.