C++ || Easy Solution ✅ || DFS ✅ || Short Code 🔥
\nIf you learn/found something new please upvote \uD83D\uDC4D\n\n\nclass Solution {\n    int n;\n    void dfs(int i, vector<vector<int>>& isConnected, vector<in
```\nIf you learn/found something new please upvote \uD83D\uDC4D\n```\n```\nclass Solution {\n    int n;\n    void dfs(int i, vector<vector<int>>& isConnected, vector<int> &vis){\n        vis[i] = 1;\n        \n        for(int j = 0; j<n; j++){\n            if(isConnected[i][j] == 1 && vis[j] == 0)\n                dfs(j, isConnected, vis);\n        }\n    }\npublic:\n    int findCircleNum(vector<vector<int>>& isConnected) {\n        n = isConnected.size();\n        \n        int ans = 0;\n        vector<int> vis(n, 0);\n        for(int i = 0; i<n; i++){\n            if(vis[i] == 0){\n                dfs(i, isConnected, vis);\n                ans++;\n            }\n        }\n        \n        return ans;\n    }\n};\n```\n\n```\nIf you learn/found something new please upvote \uD83D\uDC4D\n```
['Depth-First Search', 'C']