[Python3] Concise Union Find
Time - O(len(requests) * len(restrictions) * (log len(requests))\nSpace - O(len(n)\n\nclass Solution:\n    def friendRequests(self, n: int, restrictions: List[L
Time - O(len(requests) * len(restrictions) * (log len(requests))\nSpace - O(len(n)\n```\nclass Solution:\n    def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]:\n        parent = [i for i in range(n)] # create parent array\n        \n        def findParent(i):\n            p = parent[i] # iteratively groing through parent table until cell is a parent of itself\n            while p!=parent[p]: p = parent[p]\n            return p\n        \n        res = []\n        for l, r in requests:\n            lParent, rParent = findParent(l), findParent(r) # searching parent for both cells\n            \n            parent[lParent] = parent[rParent] = min(lParent, rParent) # applying change request\n            \n            blocked = False\n            for rl, rr in restrictions:\n                pl, pr = findParent(rl), findParent(rr) # searching the parent for both parts of restriction\n                \n                if pl == pr:  # if for any restriction parent is the same, rollback the request and mark as False\n                    blocked = True\n                    parent[lParent], parent[rParent] = lParent, rParent\n                    break\n            res.append(not blocked)\n        \n        return res\n```
[]