C++ Solution || Find bridges in a graph (Striver Graph Series)
Bridges in a Graph : If any removal of edges makes the graph has two or more different components.\n\nTo understand the problem and solution. watch https://www.
**Bridges in a Graph** : If any removal of edges makes the graph has two or more different components.\n\nTo understand the problem and solution. watch https://www.youtube.com/watch?v=2rjZH0-2lhk\n\n```\nclass Solution {\nprivate:\n    vector<int> low, tin;    \n    int timer = 0;\n    vector<vector<int>> res;\n\nprivate:\n    void dfs(int node, int parent, vector<int> adj[], vector<bool> &vis)\n    {\n        vis[node] = true;\n        tin[node] = low[node] = timer++;\n        \n        for(auto &it : adj[node])\n        {\n            if(it == parent) continue;\n            \n            if(!vis[it])\n            {\n                dfs(it, node, adj, vis);\n                \n                low[node] = min(low[node], low[it]);\n                \n                if(low[it] > tin[node])\n                {\n                    res.push_back({node, it});\n                }\n             }\n            \n            else{\n                low[node] = min(low[node], tin[it]);\n             }\n        }\n    }\n    \npublic:    \n    vector<vector<int>> criticalConnections(int n, vector<vector<int>>& edges) {\n        \n        \n        vector<int> adj[n];\n        for(auto &it : edges)\n        {\n            adj[it[0]].push_back(it[1]);\n            adj[it[1]].push_back(it[0]);\n        }\n        \n        vector<bool> vis(n, false);\n        low = vector<int>(n);\n        tin = vector<int>(n);\n        \n        for(int i = 0; i < n; i++)\n        {\n            if(!vis[i])\n                dfs(i, -1, adj, vis);                \n        }\n        \n        \n        return res;\n    }\n};\n```
['C']