Search⌘ K
AI Features

Number of Provinces

Explore how to identify groups of directly or indirectly connected cities, called provinces, using an adjacency matrix. Understand the problem constraints and implement an optimal O(n²) solution with O(n) space complexity. This lesson helps you strengthen problem-solving skills for technical interviews.

Statement

Given ...