class Solution { public: int findCircleNum(vector<vector<int>>& isConnected) { int count = 0; int m = isConnected.size(); vector<bool> visited(m,false); for(int i = 0; i < m; i++){ if(!visited[i]){ // 因为visiter是引用传递,下面访问过的值会改变 dfs(isConnected,i,visited); count++; } } return count; } void dfs(vector<vector<int>>& isConnected, int i, vector<bool> &visited){ visited[i] = true; //