Video solution | Connected Components | Intuition explained in detail | C++ | Hindi
VideoHey everyone i have created a video solution for this problem (its in hindi), it involves intuitive explanation with code, this video is part of my playlis
# Video
Hey everyone i have created a video solution for this problem (its in hindi), it involves intuitive explanation with code, this video is part of my playlist "Master Graphs"
Video link : https://youtu.be/kktdI569gDo?si=TrjUUkBsQf2EL7oU
Playlist link: : https://www.youtube.com/playlist?list=PLICVjZ3X1AcZ5c2oXYABLHlswC_1LhelY

# Code
```cpp []
class Solution {
public:
    void dfs(int i, vector<vector<int>>& isConnected, vector<bool>& visited) {

        visited[i]=true;
        for(int j=0;j<isConnected.size();j++){
            if(i!=j && isConnected[i][j]==true && visited[j]==false){
                dfs(j,isConnected,visited);
            }
        }
    }
    int findCircleNum(vector<vector<int>>& isConnected) {

        int cities= isConnected.size();
        vector<bool> visited(cities, false);
        int provinces=0;

        for(int i=0;i<cities;i++){
            if(visited[i]==false){
                dfs(i,isConnected,visited);
                provinces++;
            }
        }

        return provinces;
        
        
    }
};


```
['C++']