DIY: Number of Provinces

Solve the interview question "Number of Provinces" in this lesson.

Problem statement

Suppose there are n cities, where some are connected, while others are not. If a city c1 is connected to city c2, and city c2 ...

Access this course and 1400+ top-rated courses and projects.