[C++] Simple C++ Code || 99.63% time || 89% space
\n# If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\n    v
\n# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\n    vector<int> parent;\n    int find_set(int v)\n    {\n        if(v == parent[v])\n            return v;\n        return parent[v] = find_set(parent[v]);\n    }\n    bool union_set(int a, int b)\n    {\n        a = find_set(a);\n        b = find_set(b);\n        if(a == b)\n            return true;\n        parent[b] = a;\n        return false;\n    }\npublic:\n    vector<int> findRedundantConnection(vector<vector<int>>& edges) {\n        int n = edges.size();\n        for(int i = 0; i <= n; i++)\n            parent.push_back(i);\n        for(vector<int> &edge : edges)\n        {\n            if(union_set(edge[0], edge[1]))\n                return {edge[0], edge[1]};\n        }\n        return {-1,-1};\n    }\n};\n```
['Union Find', 'C', 'C++']