Why is this wrong? Python Union Find Solution passes 111/160
\nclass UnionF:\n    def __init__(self, n):\n        self.rank = [1 for _ in range(n)]\n        self.par = [i for i in range(n)]\n        self.n = n\n        \n
```\nclass UnionF:\n    def __init__(self, n):\n        self.rank = [1 for _ in range(n)]\n        self.par = [i for i in range(n)]\n        self.n = n\n        \n    def find(self, n):\n        # Path Compression + Finds root\n        while n != self.par[n]:\n            self.par[n] = self.par[self.par[n]]\n            n = self.par[n]\n        return n\n    \n    def union(self, n1, n2):\n        p1, p2 = self.find(n1), self.find(n2)\n        # If they aren\'t already unioned, union them\n        if p1 != p2:\n            if self.rank[p1] > self.rank[p2]:\n                self.rank[p1] += 1\n                self.par[p2] = p1\n            else:\n                self.rank[p2] += 1\n                self.par[p1] = p2\n\nclass Solution:\n    def maximumDetonation(self, bombs: List[List[int]]) -> int:\n        n = len(bombs)\n        union = UnionF(n)\n        \n        for i in range(n):\n            for j in range(i):\n                x1, y1, r1 = bombs[i][0], bombs[i][1], bombs[i][2]\n                x2, y2, r2 = bombs[j][0], bombs[j][1], bombs[j][2]\n                \n                distance = sqrt((x2-x1)**2 + (y2-y1)**2)\n                # Bombs would detonate eaach other\n                if distance <= (r1 + r2):\n                    union.union(i, j) \n        # Max rank is also the same as number of detonated bombs (connected componenets)\n        return max(union.rank)\n```\nThis is the test case it is failing:\n[[54,95,4],[99,46,3],[29,21,3],[96,72,8],[49,43,3],[11,20,3],[2,57,1],[69,51,7],[97,1,10],[85,45,2],[38,47,1],[83,75,3],[65,59,3],[33,4,1],[32,10,2],[20,97,8],[35,37,3]]\n\nI return 2 bombs detonate each other but the answer is 1 bombs detonates.\n\nSpecificially the bombs: [65, 59, 3] [69, 51, 7] are 8.94427190999916 distance apart yet the problem says they should not detonate each other. Why is this so?\n
['Union Find', 'Python']