[faster than 100.00% ][C++][beginner friendly]
Runtime: 0 ms, faster than 100.00% of C++ online submissions \nMemory Usage: 9.1 MB, less than 92.16% of C++ online submissions\n\nclass Solution {\npublic:\n  
**Runtime: 0 ms, faster than 100.00% of C++ online submissions \nMemory Usage: 9.1 MB, less than 92.16% of C++ online submissions**\n```\nclass Solution {\npublic:\n    vector<int> parent;\n    vector<int> findRedundantConnection(vector<vector<int>>& edges) {\n        if(edges.size()==0) return{};\n        parent.resize(edges.size()+1);\n        for(int i=1;i<edges.size()+1;i++){\n            parent[i]=i;\n        }\n        for(vector<int> edge : edges){\n            int f1=find(edge[0]);\n            int f2=find(edge[1]);\n            if(f1!=f2)\n                parent[f1]=f2;\n            else\n                return edge;\n        }\n        return {};\n    }\n    int find(int x){\n        return parent[x]==x ? x : find(parent[x]);\n    }\n    \n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['Union Find', 'C', 'C++']