NeetCode #592LC-547MediumGraphs
← Back to All Problems

#592 · #547 · Number of Provinces(省份数量)

📌 Problem Statement & Constraints

There are n cities, some connected. Given an n x n adjacency matrix isConnected, return the number of provinces (connected components). Constraints: 1 <= n <= 200.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!