[C++] Simple Tarjan Algo implementation with Runtime: 88.24% of C++
Runtime: 896 ms, faster than 94.65% of C++\nMemory Usage: 166.8 MB, less than 82.66% of C++\n\nclass Solution {\npublic:\n    \n    vector<vector<int>> critical
**Runtime: 896 ms, faster than 94.65% of C++**\n**Memory Usage: 166.8 MB, less than 82.66% of C++**\n```\nclass Solution {\npublic:\n    \n    vector<vector<int>> criticalConnections(int n, vector<vector<int>>& connections) {\n        vector<vector<int>> graph(n);\n        //making adj matrix;\n        for(int i=0;i<connections.size();i++){\n            graph[connections[i][0]].push_back(connections[i][1]);\n            graph[connections[i][1]].push_back(connections[i][0]);\n        }\n        \n        vector<int> discovery(n,-1);\n        //to find the other way around a perticular node (back edge)\n        vector<int> low(n,-1);\n        vector<int> parent(n,-1);\n        vector<vector<int>> bridge;\n        for(int i=0;i<n;i++){\n            if(discovery[i]==-1){\n                DFS(i,discovery,low,parent,graph,bridge);\n            }\n        }\n       \n        return bridge;\n    }\n    \n    //Trajan Algo\n    void DFS(int curr,vector<int>& discovery,vector<int>& low,vector<int>& parent,vector<vector<int>>& graph,vector<vector<int>>& bridge){\n        \n        static int time=0;\n        \n        discovery[curr]=time;\n        low[curr]=time;\n        \n        time+=1;\n        \n        for(auto nbr : graph[curr]){\n            \n            if(discovery[nbr]==-1){\n                parent[nbr]=curr;\n                DFS(nbr,discovery,low,parent,graph,bridge);\n                low[curr]=min(low[curr],low[nbr]);\n                \n                if(low[nbr]>discovery[curr]){\n                    bridge.push_back({curr,nbr});\n                }\n            }\n            else{\n                //wont consider parent child relationship edge\n                if(nbr!=parent[curr]){ \n                    low[curr]=min(low[curr],discovery[nbr]);\n                }\n            }\n        }\n    }\n};\n```
['C', 'C++']