DFS, Easy-Readable C++
```  \nvoid dfs(int x,int par,vector>&adj,vector&has)\n    {\n        for(int k:adj[x])\n        {\n            if(k==par){continue;}\n            dfs(k,x,adj,h
```  \nvoid dfs(int x,int par,vector<vector<int>>&adj,vector<bool>&has)\n    {\n        for(int k:adj[x])\n        {\n            if(k==par){continue;}\n            dfs(k,x,adj,has);\n            has[x] = (has[x]|has[k]);\n        }\n    }\n    \n    int solve(int x,int par,vector<vector<int>>&adj,vector<bool>&has)\n    {\n        if(!has[x]){return 0;}\n        int ans=0;\n        for(int k:adj[x])\n        {\n            if(k==par){continue;}\n            if(has[k])\n            {\n                ans+= solve(k,x,adj,has);\n            }\n        }\n        if(x==0)\n        {\n            return ans;\n        }\n        return ans+2;\n    }\n\n    int minTime(int n, vector<vector<int>>& edg, vector<bool>&has) \n    {\n        vector<vector<int>>adj(n);\n        for(vector<int>j:edg)\n        {\n            adj[j[0]].push_back(j[1]);\n            adj[j[1]].push_back(j[0]);\n        }\n         dfs(0,0,adj,has);\n          int ans=solve(0,0,adj,has);\n        return ans;\n        \n    }
['Depth-First Search', 'C']