Coding
Perform a depth-first search on a matrix to find connected components.
Given an n x n matrix where isConnected[i][j] = 1 if the ith node and the jth node are directly connected, and 0 otherwise, return the total number of connected components.
Input: isConnected = [[1,0,0],[0,1,0],[0,0,1]]
Output: 3
Explanation: There are no connections between any of the nodes, resulting in 3 completely isolated subgraphs.
Was asked at