ESRI INDIA HIRING | Number of Provinces Problem | Online Assessment OA Question (2023)

Question · Posted Jun 2026

Problem Statement There are n cities. Some cities are directly connected, while others are not. If city a is directly connected to city b, and city b is directly connected to city c, then city a is indirectly connected to city c. A province is a group of directly or indirectly connected cities, and no city outside the group is connected to any city inside the group. You are given an n × n adjacency matrix isConnected, where: isConnected[i][j] = ...

The full answer & interview discussion are available to premium members.

Log in Create a free account