Better than 100% of Solns
Plain union find - 323 ms\n\nclass Solution(object):\n    def friendRequests(self, n, restrictions, requests):\n        """\n        :type n: int\n        :type
Plain union find - `323 ms`\n```\nclass Solution(object):\n    def friendRequests(self, n, restrictions, requests):\n        """\n        :type n: int\n        :type restrictions: List[List[int]]\n        :type requests: List[List[int]]\n        :rtype: List[bool]\n        """\n        p = {i:i for i in range(n)}\n        \n        def find(x):\n            ox = x\n            while p[x] != x:\n                x = p[x]\n            p[ox] = x\n            return x\n        \n        bl = defaultdict(set)\n        ans = []\n        for ri, rj in restrictions:\n            bl[ri].add(rj)\n            bl[rj].add(ri)\n        for ri, rj in requests:\n            rpi, rpj = find(ri), find(rj)\n            if rpi == rpj:\n                ans.append(True)\n            else:\n                cc = rpj not in bl[rpi]\n                if cc:\n                    p[rpj] = rpi\n                    bl[rpi] = bl[rpi].union(bl[rpj])\n                    for i in bl[rpj]:\n                        bl[i].add(rpi)\n                ans.append(cc)\n            \n        return ans\n```
['Union Find', 'Python']