97 % using recursion and iterative Union find ,simple and easy in python
Method 1.1: Recursive Union Find\n\n\nclass Solution:\n    def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:\n        n = len(edges)\n    
# Method 1.1: Recursive Union Find\n\n```\nclass Solution:\n    def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:\n        n = len(edges)\n        self.parent = [ i for i in range(n+1)]\n        \n        for v, e in edges:\n            p1 = self.get_parent(v)\n            p2 = self.get_parent(e)\n            \n            if p1 == p2:\n                return [v,e]\n            \n            self.parent[p2] = p1\n            \n    # for get parent of any node       \n    def get_parent(self, node):\n        \n        if self.parent[node] == node:\n            return node\n        else:\n            return self.get_parent(self.parent[node])\n```\n\n\n# Method 1.2: Iterative Union Find\n```\nclass Solution:\n    def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:\n        n = len(edges)\n        parent = [i for i in range(n+1)]\n        \n        count = n\n        \n        for e in edges:\n                          \n            pari, parj = e\n\n            while parent[pari] != pari:\n                pari = parent[pari]\n\n            while parent[parj] != parj:\n                parj = parent[parj]\n\n            if pari == parj:\n                return e\n            \n            parent[parj] =pari\n```\n\n
['Union Find', 'Recursion', 'Iterator', 'Python']