C++ DFS 100%sc  short
Using @om_namah_shivay solution and @chillin1017 comment\n\n\nclass Solution {\npublic:\n    vector<vector<int>> ans;\n    vector<vector<int>> criticalConnectio
Using @om_namah_shivay solution and @chillin1017 comment\n\n```\nclass Solution {\npublic:\n    vector<vector<int>> ans;\n    vector<vector<int>> criticalConnections(int n, vector<vector<int>>& connections) {\n        unordered_map<int,vector<int>> g;\n        for(auto con : connections) {\n            g[con[0]].push_back(con[1]);\n            g[con[1]].push_back(con[0]);\n        }\n        vector<int> time(n);\n        unordered_set<int> visited;\n        dfs(g,0,-1,1,time,visited);\n        return ans;\n    }\n    \n    void dfs(unordered_map<int,vector<int>>& g, int cur,int par, int ts,vector<int>& time,unordered_set<int>& visited) {\n        visited.insert(cur);\n        time[cur] = ts;\n        for(int x: g[cur]) {\n            if(x == par) continue; // ignore parent\n            if(visited.find(x) == visited.end()) {\n                dfs(g,x,cur,ts + 1, time, visited); \n            } \n            time[cur] = min(time[cur], time[x]); \n            if(ts< time[x]) { // timestamp should be strictly less than neighbour for it to be critical node\n                vector<int> temp(2);\n                temp[0] = cur;\n                temp[1] = x;\n                ans.push_back(temp);\n            }\n        }\n    }\n};\n```
[]