Number of Provinces

Given an n x n matrix representing connectivity between n cities. If city i is directly connected to city j, matrix[i][j] = 1. If city i is not directly connected to city j, `matrix[i][j...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: