python 10 line union find solution, beat 90%+
python\nclass Solution:\n    def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:\n        p = list(range(len(edges) + 1))\n        def find(
```python\nclass Solution:\n    def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:\n        p = list(range(len(edges) + 1))\n        def find(x):\n            while p[x] != x:\n                p[x] = p[p[x]]\n                x = p[x]\n            return p[x]\n        for a, b in edges:\n            pa, pb = find(a), find(b)\n            if pa == pb: return [a, b]\n            p[pa] = p[pb]\n```
[]