BOEING Hiring Question | Number of Provinces | On-Campus OA (2021) Number of Provinces
Question · Posted Jun 2026
Q1: Number of Provinces (Connected Components) Problem Statement There are n cities represented by an n × n adjacency matrix isConnected, where: isConnected[i][j] = 1 indicates city i and city j are directly connected. isConnected[i][j] = 0 indicates they are not directly connected. A province is a group of directly or indirectly connected cities. Return the total number of provinces. Example Input isConnected = [[1,1,0], [1,1,0], ...
The full answer & interview discussion are available to premium members.
Log in Create a free account