[C++] Short and Simple Solution DFS
\nclass Solution {\npublic:\n    \n    vector<int>adj[100005];\n    int dfs(int node,vector<bool>& a,vector<int>&vis){\n         vis[node]=1;\n         int  cou
```\nclass Solution {\npublic:\n    \n    vector<int>adj[100005];\n    int dfs(int node,vector<bool>& a,vector<int>&vis){\n         vis[node]=1;\n         int  count=0;\n         for(auto x:adj[node]){\n            if(!vis[x]){\n             count+=dfs(x,a,vis);\n            }\n                    \n            }\n        if(count==0 && a[node]==false)\n            return count;\n           return ++count;\n    }\n    int minTime(int n, vector<vector<int>>& e, vector<bool>& a) {\n        \n        \n         vector<int>vis(n,false);\n        for(int i=0;i<e.size();i++){\n            adj[e[i][0]].push_back(e[i][1]);\n             adj[e[i][1]].push_back(e[i][0]);\n        }\n          int ans=0;\n          ans=dfs(0,a,vis);\n            if(ans==0)\n            return 0;\n            return 2*(ans-1);\n    }\n};\n```
[]