C++|DSU | DFS |Logic and comments
```\n/ The idea is to construct a MST using Krushkal \' s and then remove every edge in MST to check if it is critical or pseudo critical edge.\nAfter removing 
```\n/* The idea is to construct a MST using Krushkal \' s and then remove every edge in MST to check if it is critical or pseudo critical edge.\nAfter removing one of the edge  tree becomes a bipartite graph . Do a dfs to divide the vertex into two regions .\nNow if any edge(s) with same weight connecting both parts is found the edges are pseudo critical else the edge is critical edge\nInitially we consider every edge as critical then remove them later if it is not a critical edge\n*/\nclass Solution {\npublic:\n    int root(vector<int> &v,int x){\n        while(x!=v[x]){\n            v[x]=v[v[x]];\n            x=v[x];\n        }\n        return x;\n    }\n    bool find(vector<int> &v,int A,int B){\n        return root(v,A)==root(v,B);\n    }\n    void un(vector<int> &v,int A,int B){\n        int root_A=root(v,A);\n        int root_B=root(v,B);\n        v[root_A]=root_B;\n    }\n    void init(vector<int> &v,int n){\n        for(int i=0;i<n;++i){\n            v[i]=i;\n        }\n    }\n    void dfs(vector<vector<int> >&g,int s,vector<int> &v,int t,int n){\n        // cout<<s<<" ";\n        v[s]=t;\n        for(int i=0;i<g[s].size();++i){\n            if(v[g[s][i]]==0 && g[s][i]!=n){\n                dfs(g,g[s][i],v,t,n);\n            }\n        }\n    }\n\t//for debugging\n    void print(vector<int> &v){\n        for(int i=0;i<v.size();++i)\n            cout<<v[i]<<" ";\n        cout<<"\\n";\n    }\n    vector<vector<int>> findCriticalAndPseudoCriticalEdges(int n, vector<vector<int>>& edges) {\n        vector<int> v(n);\n        init(v,n);\n        int spnWeight=0;\n        map<int,vector<int> >m;\n        for(int i=0;i<edges.size();++i){\n            edges[i].push_back(i);\n            m[i]=edges[i];\n        }\n        \n        \n        sort(edges.begin(),edges.end(),[](vector<int> &v1,vector<int> &v2){\n            return v1[2]<v2[2];\n        });\n        \n        vector<vector<int> > g(n);\n        set<int> edgeset;\n\t\t//create MST and store it\n        for(int i=0;i<edges.size();++i){\n            if(!find(v,edges[i][0],edges[i][1])){\n                un(v,edges[i][0],edges[i][1]);\n                g[edges[i][0]].push_back(edges[i][1]);\n                g[edges[i][1]].push_back(edges[i][0]);\n                edgeset.insert(edges[i][3]);\n                spnWeight+=edges[i][2];\n            }\n        }\n        // cout<<spnWeight<<"\\n";\n        set<int> pseud;\n        vector<int> er;\n\t\t\n\t\t//iterate over the edges and find the critical edges\n        for(int i:edgeset){\n            vector<int> vertex(n);\n            dfs(g,m[i][0],vertex,1,m[i][1]);\n            dfs(g,m[i][1],vertex,2,m[i][0]);\n            // print(vertex);\n            bool f=true;\n            for(int j=0;j<edges.size();++j){\n                if(edges[j][2]<m[i][2]) continue;\n                if(edges[j][2]>m[i][2]) break;\n                if(edges[j][2]==m[i][2] && vertex[edges[j][0]]!=vertex[edges[j][1]]){\n                    // cout<<1<<" ";\n                    if(m[i][3]!=edges[j][3]){\n                        pseud.insert(edges[j][3]);\n                        f=false;\n                    }\n                }\n            }\n            \n            if(!f){\n                pseud.insert(m[i][3]);\n                er.push_back(i);\n            }\n        }\n        for(int i=0;i<er.size();++i){\n            edgeset.erase(er[i]);\n        }\n        vector<int> critical,pseudo;\n        for(int i:edgeset)\n            critical.push_back(i);\n        for(int i:pseud)\n            pseudo.push_back(i);\n        \n        vector<vector<int> >ans;\n        ans.push_back(critical);\n        ans.push_back(pseudo);\n        return ans;\n    }\n};
[]