C++ | Tarjan's | DFS | With Explanation | 93.86% faster
\nclass Solution {\n    vector<vector<int>> adjList;\n    //result\n    vector<vector<int>> bridges;\n    //discovery -> keeps track of when a node is discovere
```\nclass Solution {\n    vector<vector<int>> adjList;\n    //result\n    vector<vector<int>> bridges;\n    //discovery -> keeps track of when a node is discovered\n    //low -> keeps track of connected node with lowest discovery time(i.e. it was discovered the earliest)\n    //parent -> keeps track of the node\'s parent\n    vector<int> disc, low, parent;\n    int time;\n    void DFSHelper(int node) {\n        //update discovery and low valuesfor a node that has not been visited earier\n        //update timer\n        disc[node] = low[node] = time++;\n        \n        //dfs on all the nodes that are connected from the current node\n        for(int i = 0; i < adjList[node].size(); ++i)\n        {\n            int child = adjList[node][i];\n            //if node has not been visited before\n            if(disc[child] == -1)\n            {\n                //update parent information for child node\n                parent[child] = node;\n                DFSHelper(child);\n                \n                //while backtracking, update low value of parent to check if there is a back-edge\n                low[node] = min(low[node],low[child]);\n                \n                //check if the edge is a bridge and not a back-edge from child/sub-graph of child\n                //to it\'s parent or any of it\'s ancestors\n                if(low[child] > disc[node])\n                    bridges.push_back({node,child});\n            }\n            //check just for a single back-edge\n            else if(child != parent[node])\n                //check and update if the ancestor was discovered before the earliest connected node to our current node\n                low[node] = min(low[node],disc[child]);\n        }\n    }\npublic:\n    vector<vector<int>> criticalConnections(int n, vector<vector<int>>& connections) {\n        adjList.resize(n);\n        disc.resize(n,-1);\n        low.resize(n,-1);\n        parent.resize(n,-1);\n        time = 0;\n        \n        //build undirected graph\n        for(auto& conn : connections)\n        {\n            adjList[conn[1]].push_back(conn[0]);\n            adjList[conn[0]].push_back(conn[1]);\n        }\n\n        for(int i = 0; i < n; ++i)\n            if(disc[i] == -1)\n                DFSHelper(i);\n        \n        return bridges;\n    }\n};\n```
['Depth-First Search', 'C']